Ticket #1735 (closed bug: fixed)
unused binding changes program behaviour
| Reported by: | igloo | Owned by: | simonpj |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.12 branch |
| Component: | Compiler | Version: | 6.8 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | typecheck/should_run/T1735 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

