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-5075] Swift 4 compiler crash: unexpected storage type that differs from type-of-rvalue #47651

Closed
weissi opened this issue Jun 2, 2017 · 2 comments
Assignees
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

Comments

@weissi
Copy link
Member

weissi commented Jun 2, 2017

Previous ID SR-5075
Radar rdar://problem/32539006
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS 10.12

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

md5: 96ab55a30cef95002672bce0e7fc36ee

is duplicated by:

  • SR-5200 IRGen Verification failure with classes inheriting from a Codable base class
  • SR-5170 Complex expression with coding - broken function found

Issue Description:

The Swift 4 compiler

Apple Swift version 4.0-dev (LLVM 7d1af4e028, Clang 14f7ac7518, Swift 52fcadf409)
Target: x86_64-apple-macosx10.9

crashes for this program

public class Base {
    public init(foo: Int) {
    }

    public class func giveFoo() throws -> Int {
        return 8
    }
}

public class Sub: Base {
    public init() throws {
        try super.init(foo: Base.giveFoo())
    }
}

Remove the throws and the try and it's happy. Swift 3 is just happy 🙂

$ /Library/Developer/Toolchains/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-01-a.xctoolchain/usr/bin/swiftc crash_repro.swift 
unexpected storage type that differs from type-of-rvalue
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-4.0-package-osx/swift/lib/SILGen/SILGenLValue.cpp:2785!
0  swift                    0x00000001113f0068 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001113ef036 llvm::sys::RunSignalHandlers() + 86
2  swift                    0x00000001113f0629 SignalHandler(int) + 361
3  libsystem_platform.dylib 0x00007fff96d72b3a _sigtramp + 26
4  libsystem_platform.dylib 0x0000000116c74551 _sigtramp + 2146441777
5  libsystem_c.dylib        0x00007fff96bf7420 abort + 129
6  swift                    0x000000011138f7f7 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
7  swift                    0x000000010e8fb7f0 swift::Lowering::SILGenFunction::emitSemanticStore(swift::SILLocation, swift::SILValue, swift::SILValue, swift::Lowering::TypeLowering const&, swift::IsInitialization_t) + 1712
8  swift                    0x000000010e8f10c1 (anonymous namespace)::DelegateInitSelfWritebackCleanup::emit(swift::Lowering::SILGenFunction&, swift::CleanupLocation) + 129
9  swift                    0x000000010e86f654 swift::Lowering::CleanupManager::emitCleanups(swift::DiverseStackBase::stable_iterator, swift::CleanupLocation, bool) + 308
10 swift                    0x000000010e86f98b swift::Lowering::CleanupManager::emitBranchAndCleanups(swift::Lowering::JumpDest, swift::SILLocation, llvm::ArrayRef<swift::SILValue>) + 91
11 swift                    0x000000010e940190 swift::Lowering::SILGenFunction::getTryApplyErrorDest(swift::SILLocation, swift::SILResultInfo, bool) + 688
12 swift                    0x000000010e88a6aa swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) + 2154
13 swift                    0x000000010e88d85d (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3597
14 swift                    0x000000010e88c503 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
15 swift                    0x000000010e8e1c84 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 84
16 swift                    0x000000010e8dda49 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
17 swift                    0x000000010e8a1765 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2965
18 swift                    0x000000010e8a2dfa (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 234
19 swift                    0x000000010e8a0cff (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 303
20 swift                    0x000000010e8a01a4 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 452
21 swift                    0x000000010e89f9f8 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>&, llvm::Optional<swift::ForeignErrorConvention>&, swift::ImportAsMemberStatus&, swift::Lowering::ApplyOptions&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 2232
22 swift                    0x000000010e88d785 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3381
23 swift                    0x000000010e88c503 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
24 swift                    0x000000010e8e1c84 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 84
25 swift                    0x000000010e8e4b1e swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 12014
26 swift                    0x000000010e8dda49 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
27 swift                    0x000000010e8eaac8 (anonymous namespace)::RValueEmitter::visitRebindSelfInConstructorExpr(swift::RebindSelfInConstructorExpr*, swift::Lowering::SGFContext) + 392
28 swift                    0x000000010e8e35cd swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 6557
29 swift                    0x000000010e8ddd13 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 467
30 swift                    0x000000010e93c79d swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 557
31 swift                    0x000000010e93c565 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
32 swift                    0x000000010e8c04c7 swift::Lowering::SILGenFunction::emitClassConstructorInitializer(swift::ConstructorDecl*) + 2487
33 swift                    0x000000010e887c9e swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)::$_3::operator()(swift::SILFunction*) const + 206
34 swift                    0x000000010e880acf swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*) + 2095
35 swift                    0x000000010e945a97 (anonymous namespace)::SILGenType::emitType() + 663
36 swift                    0x000000010e9457f9 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
37 swift                    0x000000010e883f8b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 843
38 swift                    0x000000010e884f1e swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 958
39 swift                    0x000000010e885484 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 116
40 swift                    0x000000010e1e979a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8458
41 swift                    0x000000010e1e65ba swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2650
42 swift                    0x000000010e1a2bd0 main + 3312
43 libdyld.dylib            0x00007fff96b63235 start + 1
44 libdyld.dylib            0x000000000000000d start + 1766444505
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-01-a.xctoolchain/usr/bin/swift -frontend -c -primary-file crash_repro.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -color-diagnostics -module-name crash_repro -o /var/folders/k8/7d0p_dxx2ll8vnw5mt5__ddc0000gn/T/crash_repro-73489f.o 
1.  While silgen constructor initializer SIL function "@_T011crash_repro3SubCACyKcfc".
 for 'init' at crash_repro.swift:11:12
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
@airspeedswift
Copy link
Member

@swift-ci create

@slavapestov
Copy link
Member

#10413

@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
Projects
None yet
Development

No branches or pull requests

4 participants