-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
SILOptimizerArea → compiler: SIL optimization passesArea → compiler: SIL optimization passesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfmiscompileBug: Compiler produces incorrect codegenBug: Compiler produces incorrect codegenoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilation
Description
The following miscompiles and crashes with a seg fault instead of infinite looping when compiled with -O:
func foo() -> Never {
while true {}
}
func bar(_ x: Any...) {}
bar(foo())The SIL for main looks like this:
%2 = integer_literal $Builtin.Word, 1 // user: %3
%3 = alloc_ref [stack] [tail_elems $Any * %2] $_ContiguousArrayStorage<Any> // user: %4
strong_release %3 // id: %4
br bb1 // id: %5
Seems like we're ending up with a spurious release of storage that was never retained
Swift version 6.3-dev (LLVM d519e7def27afb0, Swift dcebf64)
Metadata
Metadata
Assignees
Labels
SILOptimizerArea → compiler: SIL optimization passesArea → compiler: SIL optimization passesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfmiscompileBug: Compiler produces incorrect codegenBug: Compiler produces incorrect codegenoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilation