Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,843
    • Issues 4,843
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #1735

Closed
Open
Created Sep 25, 2007 by Ian Lynagh <igloo@earth.li>@trac-igloo

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking