[GHC] #13429: Optimizer produces Core with an infinite <<loop>>
GHC
ghc-devs at haskell.org
Thu Mar 16 12:34:44 UTC 2017
#13429: Optimizer produces Core with an infinite <<loop>>
-------------------------------------+-------------------------------------
Reporter: lehins | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect result
Unknown/Multiple | at runtime
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
While using vector package to implement convolution and supplying `-O1` or
`-02` to ghc compilation results in core with an infinite loop. In order
to trigger this behavior at least two modules is required. Attached is the
minimal setup that I could come up with, that demonstrates the issue. Here
is the stack trace:
{{{
$ stack --install-ghc --resolver lts-8.3 exec -- ghc -O1 -prof -fprof-auto
main.hs && ./main +RTS -xc
[1 of 2] Compiling Loop ( Loop.hs, Loop.o )
[2 of 2] Compiling Main ( main.hs, main.o )
Linking main ...
*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace:
Main.CAF
--> evaluated by: Main.main,
called from Main.CAF
--> evaluated by: Loop.toKernel.\,
called from Data.Vector.Fusion.Util.>>=,
called from Loop.toKernel,
called from Main.main,
called from Main.CAF
--> evaluated by: Data.Vector.Fusion.Util.>>=,
called from Loop.toKernel,
called from Main.main,
called from Main.CAF
*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace:
Main.CAF
main: <<loop>>
}}}
At first I though that it might be a bug in a vector package, which is
still a possibility, but since I was not able to observe that issue with
ghc-7.8.4, I decided to open an ticket here. I tested attached code with
all of subsequent released ghc versions (7.10.1 - 8.0.2), which resulted
in the infinite loop.
Worth noting that sometimes, when recompilation of only the `main.hs` file
is enforced, program starts to work as expected. Here is an example:
{{{
$ stack --resolver ghc-7.10.3 exec --package vector-0.11.0.0 --package
primitive-0.6.1.0 -- ghc -O1 main.hs && ./main
[1 of 2] Compiling Loop ( Loop.hs, Loop.o )
[2 of 2] Compiling Main ( main.hs, main.o )
Linking main ...
main: <<loop>>
$ touch main.hs
$ stack --resolver ghc-7.10.3 exec --package vector-0.11.0.0 --package
primitive-0.6.1.0 -- ghc -O1 main.hs && ./main
[2 of 2] Compiling Main ( main.hs, main.o )
Linking main ...
<Image 1x1>
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13429>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list