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-12037] "Illegal instruction: 4" using dynamicMemberLookup with KeyPath #54474

Closed
swift-ci opened this issue Jan 15, 2020 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12037
Radar None
Original Reporter Olbo (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee None
Priority Medium

md5: 7859fe6f52b4adc1188007157fda7524

duplicates:

  • SR-11743 KeyPath Dynamic Member Lookup crash

Issue Description:

I would expect this to compile without producing an Illegal Instruction. Uncommenting the other subscript provides a workaround to allow compilation.

Xcode 11.3 (11C29)
Swift 5.1.3

@dynamicMemberLookup
public struct Object {

    public subscript(dynamicMember keyPath: KeyPath<Object, Int>) -> String {
        String(self[keyPath: keyPath])
    }
    
//    subscript(dynamicMember keyPath: KeyPath<Object, Int>) -> Int {
//        self[keyPath: keyPath]
//    }
    
    public let value = 1
}
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'test' from project 'test')
    cd /tmp/test
    export DEVELOPER_DIR=/Applications/Xcode/Xcode-11.3.0.app/Contents/Developer
    export SDKROOT=/Applications/Xcode/Xcode-11.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
    /Applications/Xcode/Xcode-11.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name test -Onone -enable-batch-mode -enforce-exclusivity=checked @/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/Objects-normal/x86_64/test.SwiftFileList -DDEBUG -v -sdk /Applications/Xcode/Xcode-11.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -target x86_64-apple-macos10.15 -g -module-cache-path /Users/oat01/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Index/DataStore -swift-version 5 -I /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Products/Debug -F /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Products/Debug -c -j8 -output-file-map /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/Objects-normal/x86_64/test-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/Objects-normal/x86_64/test.swiftmodule -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/test-generated-files.hmap -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/test-own-target-headers.hmap -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/test-all-target-headers.hmap -Xcc -iquote -Xcc /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/test-project-headers.hmap -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Products/Debug/include -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/DerivedSources-normal/x86_64 -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/DerivedSources/x86_64 -Xcc -I/Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/oat01/Library/Developer/Xcode/DerivedData/test-dthhutsfmixdgkfbohwjdhmccvqj/Build/Intermediates.noindex/test.build/Debug/test.build/Objects-normal/x86_64/test-Swift.h -working-directory /tmp/test

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-macos10.15
<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: compile command failed due to signal 4 (use -v to see invocation)
@theblixguy
Copy link
Collaborator

I could reproduce it on master & it has the same stack trace as SR-11743. cc @xedin

@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants