unused binding changes program behaviour
I'm not 100% sure this is a bug, but it's certainly surprising. If I add an unused function to my module:
#ifdef FOO
rigidTests :: Maybe (Maybe [YesNo])
rigidTests =
mkTest [Elem "No" []] (Just [No])
#endif
(mkTest has a type signature, and all the datatypes are plain old Haskell 98) then the behaviour of the program changes:
Without the function:
$ tar -zxf unused_bind_bug.tar.gz
$ cd unused_bind_bug
$ ghc -cpp --make Main
[1 of 6] Compiling SYBWC.Context ( SYBWC/Context.hs, SYBWC/Context.o )
[2 of 6] Compiling SYBWC.Basics ( SYBWC/Basics.hs, SYBWC/Basics.o )
[3 of 6] Compiling SYBWC.Instances ( SYBWC/Instances.hs, SYBWC/Instances.o )
[4 of 6] Compiling State ( State.hs, State.o )
[5 of 6] Compiling Xml ( Xml.hs, Xml.o )
[6 of 6] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ ./Main
Nothing
With the function:
$ tar -zxf unused_bind_bug.tar.gz
$ cd unused_bind_bug
$ ghc -cpp -DFOO --make Main
[1 of 6] Compiling SYBWC.Context ( SYBWC/Context.hs, SYBWC/Context.o )
[2 of 6] Compiling SYBWC.Basics ( SYBWC/Basics.hs, SYBWC/Basics.o )
[3 of 6] Compiling SYBWC.Instances ( SYBWC/Instances.hs, SYBWC/Instances.o )
[4 of 6] Compiling State ( State.hs, State.o )
[5 of 6] Compiling Xml ( Xml.hs, Xml.o )
[6 of 6] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ ./Main
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize' to increase it.
I suspect that the stack overflow is caused by my
instance (Xml a, Xml [a]) => Xml [a] where
hack to get around #1470 (closed) (and if so, that bug is more important to me).
This is with
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.0.20070923
but I had the same problem with 6.6.1.
Standalone testcase attached.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |