Skip to content
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

[SR-9909] swiftc crash with -profile-generate #52315

Closed
keith opened this issue Feb 12, 2019 · 4 comments
Closed

[SR-9909] swiftc crash with -profile-generate #52315

keith opened this issue Feb 12, 2019 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@keith
Copy link
Collaborator

keith commented Feb 12, 2019

Previous ID SR-9909
Radar None
Original Reporter @keith
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 10.2 beta 2 (10P91b)
You get this experience in Xcode if you check the box in Scheme -> Test -> Options -> Gather Code Coverage

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 2d10e3693d9aa42136a578896f00c73e

Issue Description:

With this code:

import UIKit
UIAccessibility.voiceOverStatusDidChangeNotification

Compiling it with this command:

/Applications/Xcode-10.2.0b2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc \
 -sdk /Applications/Xcode-10.2.0b2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk \
 -target x86_64-apple-ios12.0-simulator \
 -profile-generate /tmp/foo.swift \
 -emit-module

Crashes the compiler with this stack trace:

<unknown>:0: error: fatal error encountered while reading from module 'foo'; please file a bug report with your project and the crash log

*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
result not found
Cross-reference to module 'UIKit'
... UIAccessibility
... in an extension in module 'UIKit'
... GuidedAccessError

Stack dump:
0.  Program arguments: /Applications/Xcode-10.2.0b2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -merge-modules -emit-module /var/folders/q5/7_wh20z93c74nj3tllwjl5nr0000gn/T/foo-1d1a9b.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-ios12.0-simulator -enable-objc-interop -sdk /Applications/Xcode-10.2.0b2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk -profile-generate -emit-module-doc-path foo.swiftdoc -module-name foo -o foo.swiftmodule 
0  swift                    0x0000000111a6048a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x0000000111a5fc6c SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff6849eb3d _sigtramp + 29
3  libsystem_platform.dylib 0x00000001141f2bc6 _sigtramp + 2882879654
4  libsystem_c.dylib        0x00007fff6835c1c9 abort + 127
5  swift                    0x000000010ebbcf40 swift::ModuleFile::fatal(llvm::Error) + 1856
6  swift                    0x000000010ebd99ef swift::ModuleFile::readConformance(llvm::BitstreamCursor&, swift::GenericEnvironment*) + 4591
7  swift                    0x000000010ebf7808 swift::SILDeserializer::readWitnessTable(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILWitnessTable*) + 280
8  swift                    0x000000010ec90f1d swift::SerializedSILLoader::getAllForModule(swift::Identifier, swift::FileUnit*) + 589
9  swift                    0x000000010d8d15d3 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 32531
10 swift                    0x000000010d8c6097 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6823
11 swift                    0x000000010d86602d main + 1261
12 libdyld.dylib            0x00007fff682b3ed9 start + 1
13 libdyld.dylib            0x0000000000000015 start + 2547302717
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: merge-module command failed due to signal 6 (use -v to see invocation)

Removing the `-profile-generate` argument works around this crash

@belkadan
Copy link
Contributor

I'm surprised profiling makes the difference in this case, but regardless this is a known issue called out in the Xcode 10.2 beta release notes. The fix is in swift-5.0-branch already, so you should see it in a later beta!

@keith
Copy link
Collaborator Author

keith commented Feb 12, 2019

Sorry, thanks I didn't know it was the same issue!

@keith
Copy link
Collaborator Author

keith commented Feb 12, 2019

I actually don't see a reference to this in the release notes

@belkadan
Copy link
Contributor

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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.
Projects
None yet
Development

No branches or pull requests

2 participants