swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

[SR-1896] crash when compile #44505

Open swift-ci opened 8 years ago

swift-ci commented 8 years ago
Previous ID SR-1896
Radar None
Original Reporter VladimirS (JIRA User)
Type Bug
Status Reopened
Resolution
Environment Swift Ver. 3.0 (Jun 6, 2016) Target: x86_64-ubuntu-linux-gnu
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, CompilerCrash, SILGen | |Assignee | None | |Priority | Medium | md5: 2f09cf65df1cea83fe0f9ee7d0b781b4

relates to:

Issue Description:

Why I see this crash when compiling this code:

var x = [1, 2, 3, 4, 5]

print(x.reduce(0) { $0 })
swift: /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-15_10/swift/lib/SILGen/SILGenPoly.cpp:1663: void (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData &): Assertion `isa<TupleType>(innerSubstType) == isa<TupleType>(outerSubstType) || (isa<TupleType>(innerSubstType) && outerSubstType->getAnyOptionalObjectType())' failed.
0  swift           0x00000000032f4138 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift           0x00000000032f2936 llvm::sys::RunSignalHandlers() + 54
2  swift           0x00000000032f4c66
3  libpthread.so.0 0x00007f994254dd10
4  libc.so.6       0x00007f9940e951c7 gsignal + 55
5  libc.so.6       0x00007f9940e96e2a abort + 362
6  libc.so.6       0x00007f9940e8e0bd
7  libc.so.6       0x00007f9940e8e172
8  swift           0x00000000009bb65a
9  swift           0x00000000009b83a9
10 swift           0x00000000009c0f2e
11 swift           0x00000000009b4203
12 swift           0x00000000009b3afc
13 swift           0x000000000098c74e
14 swift           0x0000000000981054
15 swift           0x000000000094c697
16 swift           0x000000000094d815
17 swift           0x000000000094c164
18 swift           0x000000000094f4ef
19 swift           0x000000000094daee
20 swift           0x000000000094c164
21 swift           0x000000000094b980
22 swift           0x000000000093eeed
23 swift           0x000000000093d48d
24 swift           0x0000000000985da4
25 swift           0x00000000009891d0
26 swift           0x0000000000980f1d
27 swift           0x00000000009d0cfc swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 540
28 swift           0x000000000094c555
29 swift           0x000000000094f4ef
30 swift           0x000000000094daee
31 swift           0x000000000094c164
32 swift           0x000000000094b980
33 swift           0x000000000093eeed
34 swift           0x000000000093d48d
35 swift           0x0000000000985da4
36 swift           0x00000000009849dc
37 swift           0x0000000000934d99
38 swift           0x000000000093564b
39 swift           0x0000000000936352 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 482
40 swift           0x00000000009368e6 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
41 swift           0x00000000007d96ff
42 swift           0x00000000007d56f1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2833
43 swift           0x00000000007a26cb main + 2603
44 libc.so.6       0x00007f9940e80ac0 __libc_start_main + 240
45 swift           0x00000000007a0249 _start + 41
Stack dump:
0.  Program arguments: /usr/bin/swift -frontend -c -primary-file /swift-execution/Sources/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /swift-execution/.build/debug -enable-testing -g -module-cache-path /swift-execution/.build/debug/ModuleCache -D SWIFT_PACKAGE -emit-module-doc-path /swift-execution/.build/debug/TempCode.build/main~partial.swiftdoc -Onone -module-name TempCode -emit-module-path /swift-execution/.build/debug/TempCode.build/main~partial.swiftmodule -emit-dependencies-path /swift-execution/.build/debug/TempCode.build/main.d -emit-reference-dependencies-path /swift-execution/.build/debug/TempCode.build/main.swiftdeps -num-threads 8 -o /swift-execution/.build/debug/TempCode.build/main.swift.o 
1.  While emitting reabstraction thunk in SIL function @_TTRXFo_iP_dSi_iP_dSi_XFo_iP_dSi_iP_zoPs13ErrorProtocol__<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
ahoppen commented 8 years ago

Can't reproduce on current master. Seems to have been fixed in the meantime.

swift-ci commented 8 years ago

Comment by Vladimir (JIRA)

Please re-check this out

Swift Ver. 3.0 (Aug 30, 2016)
Platform: Linux (x86_64)

swift: /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-15_10/swift/lib/SILGen/SILGenPoly.cpp:1674: void (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData &): Assertion `isa<TupleType>(innerSubstType) == isa<TupleType>(outerSubstType) || (isa<TupleType>(innerSubstType) && outerSubstType->getAnyOptionalObjectType())' failed.
0  swift           0x00000000033f6a38 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift           0x00000000033f5236 llvm::sys::RunSignalHandlers() + 54
2  swift           0x00000000033f7566
3  libpthread.so.0 0x00007f56eabe7d10
4  libc.so.6       0x00007f56e952f1c7 gsignal + 55
5  libc.so.6       0x00007f56e9530e2a abort + 362
6  libc.so.6       0x00007f56e95280bd
7  libc.so.6       0x00007f56e9528172
8  swift           0x00000000009cc55d
9  swift           0x00000000009c9229
10 swift           0x00000000009d1ede
11 swift           0x00000000009c4f4b
12 swift           0x00000000009c489c
13 swift           0x000000000099dc30
14 swift           0x0000000000991fe4
15 swift           0x000000000095c57c
16 swift           0x000000000095a9f3
17 swift           0x000000000095bd95
18 swift           0x000000000095a225
19 swift           0x0000000000959a30
20 swift           0x000000000094a30d
21 swift           0x00000000009488bd
22 swift           0x0000000000996ed4
23 swift           0x000000000099a431
24 swift           0x0000000000991ead
25 swift           0x00000000009e1c7c swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 540
26 swift           0x000000000095ab70
27 swift           0x000000000095e681
28 swift           0x000000000095c21e
29 swift           0x000000000095a225
30 swift           0x0000000000959a30
31 swift           0x000000000094a30d
32 swift           0x00000000009488bd
33 swift           0x0000000000996ed4
34 swift           0x0000000000995aec
35 swift           0x000000000093ffa9
36 swift           0x000000000094086b
37 swift           0x0000000000941572 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 482
38 swift           0x0000000000941b06 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
39 swift           0x00000000007e23fd
40 swift           0x00000000007de2c1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2833
41 swift           0x00000000007a779b main + 2715
42 libc.so.6       0x00007f56e951aac0 __libc_start_main + 240
43 swift           0x00000000007a52a9 _start + 41
Stack dump:
0.  Program arguments: /usr/bin/swift -frontend -c -primary-file /swift-execution/Sources/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /swift-execution/.build/debug -enable-testing -g -module-cache-path /swift-execution/.build/debug/ModuleCache -D SWIFT_PACKAGE -emit-module-doc-path /swift-execution/.build/debug/TempCode.build/main~partial.swiftdoc -Onone -module-name TempCode -emit-module-path /swift-execution/.build/debug/TempCode.build/main~partial.swiftmodule -emit-dependencies-path /swift-execution/.build/debug/TempCode.build/main.d -emit-reference-dependencies-path /swift-execution/.build/debug/TempCode.build/main.swiftdeps -num-threads 8 -o /swift-execution/.build/debug/TempCode.build/main.swift.o 
1.  While emitting reabstraction thunk in SIL function @_TTRXFo_iP_dSi_iP_dSi_XFo_iP_dSi_iP_zoPs5Error__<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
ahoppen commented 8 years ago

You're right, the issue still exists or has resurfaced

swift-ci commented 7 years ago

Comment by Vladimir (JIRA)

Do you feel that the result of above code should be this:

(((((0, 1), 2), 3), 4), 5)

? I don't think. I believe the result should be just '5'.

As I understand, due to SE-0110 we should not have a tuple in place of $0 here.
(Swift 3.1 Release)