From 3ab8fb70537b3cf0678a21fdd31e99f127fe1cb2 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 9 Jul 2025 11:36:55 +0100 Subject: [PATCH] [test] Tweak a couple of crasher test cases - Make `539adae64314fae.swift` macOS-only and use guard malloc for it. - Tweak `1e4b431ffe374ef1.swift` such that it succeeds if it either times out after a minute or crashes. While here, also clean up the test case a little. --- validation-test/IDE/crashers/539adae64314fae.swift | 7 +++++-- .../compiler_crashers_2/1e4b431ffe374ef1.swift | 8 -------- .../compiler_crashers_2/a5fbf4336df96867.swift | 11 +++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 validation-test/compiler_crashers_2/1e4b431ffe374ef1.swift create mode 100644 validation-test/compiler_crashers_2/a5fbf4336df96867.swift diff --git a/validation-test/IDE/crashers/539adae64314fae.swift b/validation-test/IDE/crashers/539adae64314fae.swift index 8c1da730807da..d0bcd7f7763fa 100644 --- a/validation-test/IDE/crashers/539adae64314fae.swift +++ b/validation-test/IDE/crashers/539adae64314fae.swift @@ -1,5 +1,8 @@ -// {"kind":"complete","signature":"void std::__1::__introsort, llvm::raw_ostream&)::$_0&, swift::NullTerminatedStringRef*, false>(swift::NullTerminatedStringRef*, swift::NullTerminatedStringRef*, printCodeCompletionLookedupTypeNames(llvm::ArrayRef, llvm::raw_ostream&)::$_0&, std::__1::iterator_traits::difference_type, bool)"} -// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +// {"kind":"complete","signature":"void std::__1::__introsort, llvm::raw_ostream&)::$_0&, swift::NullTerminatedStringRef*, false>(swift::NullTerminatedStringRef*, swift::NullTerminatedStringRef*, printCodeCompletionLookedupTypeNames(llvm::ArrayRef, llvm::raw_ostream&)::$_0&, std::__1::iterator_traits::difference_type, bool)","useGuardMalloc":true} +// RUN: env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +// REQUIRES: OS=macosx +// REQUIRES: no_asan +// REQUIRES: target-same-as-host struct a (swift::TypeBase*)>) const::Transform>::doIt(swift::Type, swift::TypePosition)"} -// RUN: not --crash %target-swift-frontend -typecheck %s -@dynamicMemberLookup struct a b, subscript - (dynamicMember d: WritableKeyPath) - a -} -let binding = a { ?? buffer ?? binding.e diff --git a/validation-test/compiler_crashers_2/a5fbf4336df96867.swift b/validation-test/compiler_crashers_2/a5fbf4336df96867.swift new file mode 100644 index 0000000000000..fe108279f9da8 --- /dev/null +++ b/validation-test/compiler_crashers_2/a5fbf4336df96867.swift @@ -0,0 +1,11 @@ +// {"kind":"typecheck","signature":"swift::TypeTransform (swift::TypeBase*)>) const::Transform>::doIt(swift::Type, swift::TypePosition)"} +// The issue here is that the solver attempts to recursively apply the same +// dynamic member lookup until eventually it overflows the stack. Make sure +// we either timeout or crash. +// RUN: not %{python} %S/../../test/Inputs/timeout.py 60 %target-swift-frontend -typecheck %s || \ +// RUN: not --crash %target-swift-frontend -typecheck %s +@dynamicMemberLookup struct S { + init(_: () -> T) {} + subscript(dynamicMember d: WritableKeyPath) -> S {} +} +let x = S { x.e }