#2169: Compilation fails first time without giving an error, later succeeds
without changing code
-------------------------------+--------------------------------------------
Reporter: nccb | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.8.2 | Severity: normal
Keywords: | Testcase:
Architecture: x86_64 (amd64) | Os: Linux
-------------------------------+--------------------------------------------
There is one particular module in our Haskell project that causes GHC to
act oddly. We compile using GHC --make Main, and compilation on this
particular module often fails on the first attempt. There are no errors
given, just a lot of warnings of the form "Defined but not used: ..." (we
are *not* using -Werror anywhere). All these warnings are about unused
bindings (e.g. foo x y = x, gives unused warning about y) -- even though
we don't use the -fwarn-unused-matches option anywhere, nor -Wall.
If you then try to execute the same command several times, it usually
succeeds on around the fourth attempt, without altering anything
whatsoever. This bug is persistent -- it happens often, usually from a
clean start (of compiling the whole project).
The command used for GHC is:
{{{ghc $(GHC_OPTS) -o tock$(EXEEXT) --make Main -odir obj -hidir obj}}}
where:
{{{
GHC_OPTS = \
-fglasgow-exts \
-fwarn-deprecations \
-fwarn-duplicate-exports \
-fwarn-incomplete-record-updates \
-fwarn-missing-fields \
-fwarn-missing-methods \
-fwarn-missing-signatures \
-fwarn-overlapping-patterns \
-fwarn-simple-patterns \
-fwarn-type-defaults \
-fwarn-unused-binds \
-fwarn-unused-imports \
-ibackends -ichecks -icommon -idata -iflow -ifrontends -ipass
-itransformations \
-v -dcore-lint -XUndecidableInstances -fwarn-tabs -fwarn-
monomorphism-restriction
}}}
(The -v and -dcore-lint flags were added to try and track down the bug).
Output from the failed compilation is as follows:
{{{
compile: input file flow/FlowGraph.hs
*** Checking old interface for main:FlowGraph:
[42 of 51] Compiling FlowGraph ( flow/FlowGraph.hs, obj/FlowGraph.o
)
*** Parser:
*** Renamer/typechecker:
flow/FlowGraph.hs:274:10: Warning: Defined but not used: `m'
flow/FlowGraph.hs:322:26: Warning: Defined but not used: `m'
flow/FlowGraph.hs:334:40: Warning: Defined but not used: `m'
flow/FlowGraph.hs:339:36: Warning: Defined but not used: `m'
flow/FlowGraph.hs:339:38: Warning: Defined but not used: `rep'
flow/FlowGraph.hs:357:31:
Warning: Defined but not used: `outStartA'
flow/FlowGraph.hs:375:27: Warning: Defined but not used: `m'
flow/FlowGraph.hs:383:26: Warning: Defined but not used: `str'
flow/FlowGraph.hs:383:31: Warning: Defined but not used: `route'
flow/FlowGraph.hs:391:27: Warning: Defined but not used: `m'
flow/FlowGraph.hs:398:26: Warning: Defined but not used: `m'
flow/FlowGraph.hs:415:49: Warning: Defined but not used: `m'
flow/FlowGraph.hs:419:19: Warning: Defined but not used: `pId'
flow/FlowGraph.hs:419:24: Warning: Defined but not used: `nStart'
flow/FlowGraph.hs:419:32: Warning: Defined but not used: `nEnd'
flow/FlowGraph.hs:419:46: Warning: Defined but not used: `m'
flow/FlowGraph.hs:430:19: Warning: Defined but not used: `pId'
flow/FlowGraph.hs:430:24: Warning: Defined but not used: `nStart'
flow/FlowGraph.hs:430:32: Warning: Defined but not used: `nEnd'
flow/FlowGraph.hs:443:19: Warning: Defined but not used: `pId'
flow/FlowGraph.hs:443:24: Warning: Defined but not used: `nStart'
flow/FlowGraph.hs:443:32: Warning: Defined but not used: `nEnd'
flow/FlowGraph.hs:509:46: Warning: Defined but not used: `m'
flow/FlowGraph.hs:557:20: Warning: Defined but not used: `m'
*** Deleting temp files:
Deleting: /tmp/ghc2747_0/ghc2747_0.s
Warning: deleting non-existent /tmp/ghc2747_0/ghc2747_0.s
Upsweep partially successful.
*** Deleting temp files:
Deleting:
link(batch): upsweep (partially) failed OR
Main.main not exported; not linking.
*** Deleting temp files:
Deleting: /tmp/ghc2747_0/ghc2747_1.hscpp /tmp/ghc2747_0/ghc2747_0.hscpp
*** Deleting temp dirs:
Deleting: /tmp/ghc2747_0
make[1]: *** [tock] Error 1
make[1]: Leaving directory `/home/neil/work/tock/branches/ghc-bug'
make: *** [all] Error 2
}}}
When the compilation later succeeds the output is as follows:
{{{
compile: input file flow/FlowGraph.hs
*** Checking old interface for main:FlowGraph:
[42 of 51] Compiling FlowGraph ( flow/FlowGraph.hs, obj/FlowGraph.o
)
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 11538
*** Core Linted result of Desugar:
*** Simplify:
Result size = 8648
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 7809
*** Core Linted result of Simplifier phase 0, iteration 2 out of 4:
Result size = 7797
*** Core Linted result of Simplifier phase 0, iteration 3 out of 4:
Result size = 7797
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 7959
*** Core Linted result of Tidy Core:
writeBinIface: 37 Names
writeBinIface: 167 dict entries
*** CorePrep:
Result size = 9571
*** Core Linted result of CorePrep:
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler:
gcc -march=athlon64 -Wa,--noexecstack -Iflow -c /tmp/ghc3185_0/ghc3185_0.s
-o obj/FlowGraph.o
*** Deleting temp files:
Deleting: /tmp/ghc3185_0/ghc3185_0.s
}}}
The code in question is from http://offog.org/darcs/tock/ (version as of
22/3/08 4pm) -- I don't think it would easy to isolate the problem. The
module in question (flow/FlowGraph.hs) can be found there.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2169>
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