#1735: unused binding changes program behaviour
-----------------------+----------------------------------------------------
Reporter: igloo | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8
Severity: normal | Keywords:
Difficulty: Unknown | Os: Unknown
Testcase: | Architecture: Unknown
-----------------------+----------------------------------------------------
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 (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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1735>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs