swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-285] Compiler crash if func is in main file, but works if func is in other file

Open jepers opened this issue 10 years ago • 2 comments

Previous ID SR-285
Radar rdar://23677338
Original Reporter @jepers
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

OS X 10.11.2, Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 69940d166c)

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

md5: 3d4c50bb14921d32582752ef00d0f3af

Issue Description:

The current project I'm working on compiles only when compiling in release mode with whole module optimization.

If I try to compile it in debug mode (or release mode without whole module optimization), the compiler will crash.

I've managed to strip the code down to a tiny example consisting of two swift files that should help to isolate the problem.

See code and comments of attached files for more info.
(I just filed another bug report about something only working with whole module optimization, but this one has nothing to do with SIMD and crashes the compiler in a different way).

jepers avatar Dec 17 '15 22:12 jepers

The issue here is that IR generation needs to perform layout of StaticStorageSuccessorOf<...>, which depends on the conformance to StaticStorageType, but the type checker has "no" reason to evaluate that conformance from a different file. Forcing the conformance from another file (e.g., adding some call that uses a StaticStorageSuccessorOf as a StaticStorageType) will work around the problem.

DougGregor avatar Oct 03 '17 23:10 DougGregor

Should finally be fixed by https://github.com/apple/swift/pull/19825

DougGregor avatar Oct 11 '18 05:10 DougGregor