Skip to content

Numeric literal very badly optimized

Compile the following program with -ddump-simpl

main = interact $ show . (< 1e40) . read

Note how there's no literal value 1e40::Double anywhere in the code. Instead there's a call to fromRat to do the conversion.

Now replace 1e40 with (1e40::Double), and the code looks good. So it seems that when defaulting is involved the code is much worse.

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