Skip to content

RegionAnalysis.cpp:3708: bool canComputeRegionsForFunction(SILFunction *): Assertion ... failed #80240

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
finestructure opened this issue Mar 24, 2025 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@finestructure
Copy link

finestructure commented Mar 24, 2025

Description

I've hit a compiler crash compiling a project with a 6.1 nightly (swiftlang/swift@sha256:7b9e690dc9253ae6ca86f5f7f9552e648febc47a2f731ffdfc0cd255b042336c, swift-6.1-DEVELOPMENT-SNAPSHOT-2025-03-12-a) on Linux x86.

The full build log is available here: https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/actions/runs/14036623657/job/39296068166

The full assertion failure is

RegionAnalysis.cpp:3708: bool canComputeRegionsForFunction(SILFunction *): Assertion `fn->getASTContext().LangOpts.StrictConcurrencyLevel == StrictConcurrency::Complete && "Need strict concurrency to be enabled for RegionBasedIsolation to be " "enabled as well"' failed

Reproduction

git clone https://github.com/cpisciotta/xcbeautify.git
cd xcbeautify && git checkout 2.25.1 && make build

Stack dump

Stack dump:
0.	Program arguments: /usr/bin/swift-frontend -frontend -c /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Array+Safe.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/CaptureGroups.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Constants.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Formatter.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/JunitReporter.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/OutputHandler.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Parser.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/FileComponents.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/Microsoft/AzureDevOpsPipelinesRenderer.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/Microsoft/GitHubActionsRenderer.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/Microsoft/MicrosoftOutputRendering.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/OutputRendering.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/TeamCityRenderer.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Renderers/TerminalRenderer.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/String+Colored.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/String+Substring.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/XCBeautifier.swift /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/XCRegex.swift -supplementary-output-file-map /tmp/TemporaryDirectory.eJofku/supplementaryOutputs-1 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/Modules -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -enable-experimental-feature StrictConcurrency=targeted -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature DeprecateApplicationMain -enable-upcoming-feature DisableOutwardActorInference -enable-upcoming-feature DynamicActorIsolation -enable-upcoming-feature ExistentialAny -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature FullTypedThrows -enable-upcoming-feature GlobalActorIsolatedTypesUsability -enable-upcoming-feature ImplicitOpenExistentials -enable-upcoming-feature ImportObjcForwardDeclarations -enable-upcoming-feature InferSendableFromCaptures -enable-upcoming-feature InternalImportsByDefault -enable-upcoming-feature IsolatedDefaultValues -enable-upcoming-feature RegionBasedIsolation -empty-abi-descriptor -disable-sandbox -resource-dir /usr/lib/swift -file-compilation-dir /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify -Xcc -fPIC -Xcc -g -Xcc -fno-omit-frame-pointer -module-name XcbeautifyLib -package-name xcbeautify -in-process-plugin-server-path /usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -enable-default-cmo -parse-as-library -num-threads 4 -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/Array+Safe.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/CaptureGroups.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/Constants.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/Formatter.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/JunitReporter.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/OutputHandler.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/Parser.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/FileComponents.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/AzureDevOpsPipelinesRenderer.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/GitHubActionsRenderer.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/MicrosoftOutputRendering.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/OutputRendering.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/TeamCityRenderer.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/TerminalRenderer.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/String+Colored.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/String+Substring.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/XCBeautifier.swift.o -o /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/.build/x86_64-unknown-linux-gnu/release/XcbeautifyLib.build/XCRegex.swift.o
1.	Swift version 6.1-dev (LLVM 08670c03fe16573, Swift 493744d5e4900b2)
2.	Compiling with effective version 5.10
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for XcbeautifyLib)
4.	While running pass #21129 SILFunctionTransform "SendNonSendable" on SILFunction "@$sSa13XcbeautifyLibE4safexSgSi_tcig".
 for getter for subscript(safe:) (at /__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify/Sources/XcbeautifyLib/Array+Safe.swift:5:5)
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 0x0000561642b755d8
1  swift-frontend 0x0000561642b730fe
2  swift-frontend 0x0000561642b75c78
3  libc.so.6      0x00007f5d61ec2520
4  libc.so.6      0x00007f5d61f169fc pthread_kill + 300
5  libc.so.6      0x00007f5d61ec2476 raise + 22
6  libc.so.6      0x00007f5d61ea87f3 abort + 211
7  libc.so.6      0x00007f5d61ea871b
8  libc.so.6      0x00007f5d61eb9e96
9  swift-frontend 0x000056163c2333d7
10 swift-frontend 0x000056163c235c68
11 swift-frontend 0x000056163c47e4c4
12 swift-frontend 0x000056163c47bebc
13 swift-frontend 0x000056163bf00272
14 swift-frontend 0x000056163bf01551
15 swift-frontend 0x000056163bf047be
16 swift-frontend 0x000056163befdf88
17 swift-frontend 0x000056163befdf3d
18 swift-frontend 0x000056163bf518ca
19 swift-frontend 0x000056163bf262b6
20 swift-frontend 0x000056163befe17f
21 swift-frontend 0x000056163bf3e701
22 swift-frontend 0x000056163b89f088
23 swift-frontend 0x000056163b544c47
24 swift-frontend 0x000056163b543dfa
25 swift-frontend 0x000056163b5549fa
26 swift-frontend 0x000056163b546a8e
27 swift-frontend 0x000056163b545b58
28 swift-frontend 0x000056163b3014ab
29 libc.so.6      0x00007f5d61ea9d90
30 libc.so.6      0x00007f5d61ea9e40 __libc_start_main + 128
31 swift-frontend 0x000056163b3004a5

Expected behavior

No crash

Environment

Linux x86

swift-6.1-DEVELOPMENT-SNAPSHOT-2025-03-12-a

swiftlang/swift@sha256:7b9e690dc9253ae6ca86f5f7f9552e648febc47a2f731ffdfc0cd255b042336c

Additional information

No response

@finestructure finestructure added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Mar 24, 2025
@finestructure
Copy link
Author

This might be important: the build flags include --sanitize=thread.

@finestructure
Copy link
Author

Also fails with a newer image:

swift-6.1-DEVELOPMENT-SNAPSHOT-2025-03-20-a
swiftlang/swift@sha256:ace168ac74bcb2482df6b1380838c4afd64b151a97382a276c6d85a44777e1c2

Notable: this is x86 specific. The same build passes with an arm64 base image.

@finestructure
Copy link
Author

Sorry, I just realised that the build is actually failing in our pre-build step where we build xcbeautify:

git clone https://github.com/cpisciotta/xcbeautify.git .build/checkouts/xcbeautify
Cloning into '.build/checkouts/xcbeautify'...
cd .build/checkouts/xcbeautify && git checkout 2.25.1 && make build
Note: switching to '2.25.1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
  git switch -c <new-branch-name>
Or undo this operation with:
  git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at b284c01 Bump version to 2.25.1
make[1]: Entering directory '/__w/SwiftPackageIndex-Server/SwiftPackageIndex-Server/.build/checkouts/xcbeautify'
/usr/bin/swift build --configuration release --disable-sandbox

This should make it much easier to reproduce. It probably also means this isn't related to x86/arm64 or Tsan but I'll re-test this and follow up.

Sorry for the confusion!

@finestructure
Copy link
Author

finestructure commented Mar 24, 2025

Update: also fails on arm64. Easy reproducer:

git clone https://github.com/cpisciotta/xcbeautify.git
cd xcbeautify && git checkout 2.27.0 && make build

xcbeautify's build command does not include Tsan flags, that was a red herring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant