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-7231] Nested RawRepresentable enum in constrained extension on generic type raises assertion in release build #49779

Closed
swift-ci opened this issue Mar 19, 2018 · 2 comments
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 optimized only Flag: An issue whose reproduction requires optimized compilation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7231
Radar None
Original Reporter neightchan (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, OptimizedOnly
Assignee None
Priority Medium

md5: 3ce8a7befcb327b8ad968dc686eace85

Issue Description:

TOOLCHAINS=org.swift.4120180318a

The following code

struct S {}
struct T<Element> {}

extension T where Element == S {

    enum Number: Int {
        case one = 1
    }
    
}

when compiled in release mode generates the following output:

Assertion failed: (!isPolymorphic() && "no args for polymorphic substitution"), function substGenericArgs, file /Users/buildnode/jenkins/workspace/oss-swift-4.1-package-osx/swift/lib/SIL/SILFunctionType.cpp, line 2469.
0  swift                    0x00000001111fd4c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001111fdbd6 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff70414f5a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000100000001 _sigtramp + 2411638977
4  libsystem_c.dylib        0x00007fff7023f312 abort + 127
5  libsystem_c.dylib        0x00007fff70207368 basename_r + 0
6  swift                    0x000000010e8a515a swift::SILFunctionType::substGenericArgs(swift::SILModule&, llvm::ArrayRef<swift::Substitution>) + 138
7  swift                    0x000000010e922429 swift::SILType::substGenericArgs(swift::SILModule&, llvm::ArrayRef<swift::Substitution>) const + 41
8  swift                    0x000000010e8d123e swift::ApplyInst::create(swift::SILDebugLocation, swift::SILValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::SILValue>, bool, llvm::Optional<swift::SILModuleConventions>, swift::SILFunction&, swift::SILOpenedArchetypesState&, swift::GenericSpecializationInformation const*) + 78
9  swift                    0x000000010e700e18 swift::SILBuilder::createApply(swift::SILLocation, swift::SILValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::SILValue>, bool, swift::GenericSpecializationInformation const*) + 216
10 swift                    0x000000010e4da268 swift::tryDevirtualizeWitnessMethod(swift::ApplySite) + 2008
11 swift                    0x000000010e4daa83 swift::tryDevirtualizeApply(swift::ApplySite, swift::ClassHierarchyAnalysis*) + 195
12 swift                    0x000000010e64687e (anonymous namespace)::Devirtualizer::run() + 830
13 swift                    0x000000010e560326 swift::SILPassManager::runPassOnFunction(swift::SILFunctionTransform*, swift::SILFunction*) + 4054
14 swift                    0x000000010e5615f4 swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) + 1396
15 swift                    0x000000010e562900 swift::SILPassManager::runOneIteration() + 944
16 swift                    0x000000010de0ce9b swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
17 swift                    0x000000010e56b475 swift::runSILOptimizationPasses(swift::SILModule&) + 117
18 swift                    0x000000010dcb42d3 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13587
19 swift                    0x000000010dcafdd0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3376
20 swift                    0x000000010dc6f683 main + 3075
21 libdyld.dylib            0x00007fff70193115 start + 1
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-18-a.xctoolchain/usr/bin/swift -frontend -c /../path/to/project/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType/main.swift -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /path/to/Applications/Xcode93Beta4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Products/Release -F /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Products/Release -g -module-cache-path /Users/user/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4 -O -serialize-debugging-options -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-generated-files.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-own-target-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-all-target-headers.hmap -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-project-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Products/Release/include -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/DerivedSources/x86_64 -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/DerivedSources -Xcc -working-directory/../path/to/project/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType -emit-module-doc-path /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.swiftdoc -serialize-diagnostics-path /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/main.dia -module-name NestedRawRepresentableEnumInConstrainedExtensionOnGenericType -emit-module-path /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.swiftmodule -emit-objc-header-path /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-Swift.h -emit-dependencies-path /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/main.d -num-threads 8 -o /Users/user/Library/Developer/Xcode/DerivedData/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType-abhwpyebhbzwnbcmijtdamnssijh/Build/Intermediates.noindex/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Release/NestedRawRepresentableEnumInConstrainedExtensionOnGenericType.build/Objects-normal/x86_64/main.o 
1.  While running pass #&#8203;372 SILFunctionTransform "Indirect Call Devirtualization" on SILFunction "@_T0s2eeoiSbx_xts16RawRepresentableRzs9Equatable0B5ValueRpzlF06NestedbC39EnumInConstrainedExtensionOnGenericType1TVA2F1SVRszlE6NumberOyAJ_G_Tg5".
 for '==(_:_:)' in module 'Swift'
@belkadan
Copy link
Contributor

Seems to be fixed on master. shajrawi (JIRA User), does this look like anything that was fixed recently?

@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

Yep - resolved on master as @belkadan said: #15064

@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 optimized only Flag: An issue whose reproduction requires optimized compilation
Projects
None yet
Development

No branches or pull requests

3 participants