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-13243] Internal compiler error in AllocBoxToStack.cpp #55683

Closed
swift-ci opened this issue Jul 17, 2020 · 2 comments
Closed

[SR-13243] Internal compiler error in AllocBoxToStack.cpp #55683

swift-ci opened this issue Jul 17, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software SILOptimizer Area → compiler: SIL optimization passes swift 5.3

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Jul 17, 2020

Previous ID SR-13243
Radar None
Original Reporter andreasw (JIRA User)
Type Bug

Attachment: Download

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

md5: 41e7eb288fad34a9cbde6bb42acbd72f

Issue Description:

Swift version 5.3-dev (LLVM 52fd0ee, Swift 19f27d9)
Target: x86_64-unknown-linux-gnu

Reduced test case attached.

Stack trace:

swift-frontend: /home/build-user/swift/lib/SILOptimizer/Transforms/AllocBoxToStack.cpp:845: void (anonymous namespace)::PromotedParamCloner::checkNoPromotedBoxInApply(swift::ApplySite): Assertion `OrigPromotedParameters.count(O.get()) == 0' failed.
Stack dump:
0. Program arguments: /home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend -frontend -c -primary-file Matrix.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -O -module-name Matrix -o /tmp/Matrix-571365.o
1. Swift version 5.3-dev (LLVM 52fd0ee4eedefee, Swift 19f27d9c94e9d96)
2. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, Serialize, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for Matrix.Matrix)
3. While running pass #261 SILFunctionTransform "AllocBoxToStack" on SILFunction "@$s6Matrix1BV1jyyF" for 'j()' (at Matrix.swift:12:9)
#0 0x0000000004feb404 PrintStackTraceSignalHandler(void*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x4feb404)
#1 0x0000000004fe91be llvm::sys::RunSignalHandlers() (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x4fe91be)
#2 0x0000000004feb6d5 SignalHandler(int) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x4feb6d5)
#3 0x00007ff4ffde73c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007ff4fe2d318b raise /build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007ff4fe2b2859 abort /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007ff4fe2b2729 get_sysdep_segment_value /build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007ff4fe2b2729 _nl_load_domain /build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007ff4fe2c3f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#9 0x0000000000aa3487 swift::SILInstructionVisitor<(anonymous namespace)::PromotedParamCloner, void>::visit(swift::SILInstruction*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xaa3487)
#10 0x0000000000a8cd4d specializeApplySite(swift::SILOptFunctionBuilder&, swift::ApplySite, llvm::SmallVector<unsigned int, 8u>&, (anonymous namespace)::AllocBoxToStackState&) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa8cd4d)
#11 0x0000000000a88db6 (anonymous namespace)::AllocBoxToStack::run() (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa88db6)
#12 0x0000000000a25682 swift::SILPassManager::runPassOnFunction(unsigned int, swift::SILFunction*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa25682)
#13 0x0000000000a2653a swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa2653a)
#14 0x0000000000a23b08 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa23b08)
#15 0x0000000000a23abb swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa23abb)
#16 0x0000000000a43b9a swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa43b9a)
#17 0x0000000000a2ea80 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa2ea80)
#18 0x0000000000a23ce5 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa23ce5)
#19 0x0000000000a3183f swift::runSILOptimizationPasses(swift::SILModule&) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0xa3183f)
#20 0x0000000000633f0b swift::CompilerInstance::performSILProcessing(swift::SILModule*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x633f0b)
#21 0x000000000050d35f performCompileStepsPostSILGen(swift::CompilerInstance&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x50d35f)
#22 0x00000000004fdfbb swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x4fdfbb)
#23 0x0000000000491f0d main (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x491f0d)
#24 0x00007ff4fe2b40b3 __libc_start_main /build/glibc-YYA7BZ/glibc-2.31/csu/../csu/libc-start.c:342:3
#25 0x0000000000491aae _start (/home/gonsolo/downloads/swift-DEVELOPMENT-SNAPSHOT-2020-07-15-a-ubuntu20.04/usr/bin/swift-frontend+0x491aae)
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@gonsolo
Copy link
Contributor

gonsolo commented Oct 4, 2022

As of Swift 5.7 this works. Slightly changed test case to fix a warning. @shahmishal

public protocol A {
        associatedtype X: BinaryFloatingPoint
        init()
}

public struct B<C: A> {

        public init() {
                d = C()
        }

        func j() -> Int {
                var h = 0
                var i = 0

                func f() {
                        var _: C.X = 0.0
                        i = 0
                }

                func g() {
                        f()
                        h = 0
                }

                g()

                return h + i
        }

        var d: C 
}

@gonsolo
Copy link
Contributor

gonsolo commented May 1, 2023

Can somebody close this? @AnthonyLatsis

@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software SILOptimizer Area → compiler: SIL optimization passes swift 5.3 labels May 2, 2023
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 itself crash Bug: A crash, i.e., an abnormal termination of software SILOptimizer Area → compiler: SIL optimization passes swift 5.3
Projects
None yet
Development

No branches or pull requests

3 participants