Optimization causes repeated computation
The attached program, when compiled with -O0
, calls array_adjust
6 times and hence prints 6 lines of trace output. However, with -O1
, it prints 37 lines of trace output instead. Moreover, this number grows quadratically rather than linearly when I increase the value of n
.
-fno-state-hack
did not help.
I can reproduce the issue with both GHC 7.8.4 and 7.10.0.20150123.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.1-rc1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |