Skip to content

Invalid nested extension hits AvailabilityScope verifier failure with -library-level api #81834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hamishknight opened this issue May 29, 2025 · 0 comments
Labels
availability The @available attribute and availability checking in general bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software found by fuzzer Flag: An issue found by fuzzing the compiler

Comments

@hamishknight
Copy link
Contributor

hamishknight commented May 29, 2025

The following hits an AvailabilityScope verification error when built with -library-level api:

public class C {
  public subscript() -> Int {
    get {
      extension C {}
Stack dump:
0.      Program arguments: /Users/hamish/src/swift-dev/build/Release/swift-macosx-arm64/bin/swift-frontend -typecheck /Users/hamish/src/swift-test-arena/main.swift -sdk /Users/hamish/src/MacOSX.sdk -debug-diagnostic-names -diagnostic-style=llvm -library-level api
1.      Swift version 6.2-dev (LLVM b3ce1bce68b3ae6, Swift 8b4740f0ccf6218)
2.      Compiling with effective version 5.10
3.      Abort: function verificationError at AvailabilityScope.cpp:531
|       child source range not contained
|       child:
|       (decl_implicit version=15.0 decl=extension.C src_range=[/Users/hamish/src/swift-test-arena/main.swift:1277:7 - line:1277:21])
|       parent:
|       (decl_implicit version=15.0 decl=_ src_range=[/Users/hamish/src/swift-test-arena/main.swift:1276:9 - line:1277:20]
|         (decl_implicit version=15.0 decl=extension.C src_range=[/Users/hamish/src/swift-test-arena/main.swift:1277:7 - line:1277:21]  ))
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x00000001087ba020 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x00000001087b833c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x00000001087ba69c SignalHandler(int, __siginfo*, void*) + 324
3  libsystem_platform.dylib 0x0000000182672744 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001826688cc pthread_kill + 296
5  libsystem_c.dylib        0x000000018256f7ac abort + 124
6  swift-frontend           0x000000010442d684 _abortWithMessage(llvm::StringRef) + 172
7  swift-frontend           0x000000010442d748 _ABORT(char const*, int, char const*, llvm::StringRef) + 0
8  swift-frontend           0x00000001040f5000 swift::AvailabilityScope::verify(swift::AvailabilityScope const*, swift::ASTContext&) const + 516
9  swift-frontend           0x00000001040f4e40 swift::AvailabilityScope::verify(swift::AvailabilityScope const*, swift::ASTContext&) const + 68
10 swift-frontend           0x00000001040f4e40 swift::AvailabilityScope::verify(swift::AvailabilityScope const*, swift::ASTContext&) const + 68
11 swift-frontend           0x00000001040ab920 swift::verify(swift::SourceFile&) + 116
12 swift-frontend           0x000000010437ad74 swift::TypeCheckPrimaryFileRequest::cacheResult(std::__1::tuple<>) const + 76
13 swift-frontend           0x0000000103e45ee0 swift::performTypeChecking(swift::SourceFile&) + 92
14 swift-frontend           0x0000000102e60ed4 bool llvm::function_ref<bool (swift::SourceFile&)>::callback_fn<swift::CompilerInstance::performSema()::$_0>(long, swift::SourceFile&) + 16
15 swift-frontend           0x0000000102e580f8 swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<bool (swift::SourceFile&)>) + 164
16 swift-frontend           0x0000000102e58034 swift::CompilerInstance::performSema() + 76
17 swift-frontend           0x0000000102c18750 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 60
18 swift-frontend           0x0000000102c0e0a0 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 700
19 swift-frontend           0x0000000102c0d89c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2276
20 swift-frontend           0x00000001029d9f28 swift::mainEntry(int, char const**) + 3112
21 dyld                     0x00000001822b1c84 start + 7040
@hamishknight hamishknight added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software availability The @available attribute and availability checking in general found by fuzzer Flag: An issue found by fuzzing the compiler labels May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
availability The @available attribute and availability checking in general bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software found by fuzzer Flag: An issue found by fuzzing the compiler
Projects
None yet
Development

No branches or pull requests

1 participant