Skip to content

Strictness is not preserved under -O1

With -O0, the attached code prints:

> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O0 src/foo.hs; and ./src/foo
[1 of 1] Compiling Main             ( src/foo.hs, src/foo.o ) [Optimisation flags changed]
Linking src/foo ...
("exec",0)
("depth",0)
("exec",1)
("depth",0)

But with -O1, it prints:

> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O1 src/foo.hs; and ./src/foo
[1 of 1] Compiling Main             ( src/foo.hs, src/foo.o )
Linking src/foo ...
("depth",0)
("depth",0)

Reproduced with 8.4.1 and 8.6.2. Doesn't seem to happen under 8.2.0

Trac metadata
Trac field Value
Version 8.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC me@alang.ca
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information