
#10531: modules that can be linked successfully when compiled with optimizations, fail to link with: multiple definition of `__stginit_ZCMain' -------------------------------------+------------------------------------- Reporter: imz | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: GHC rejects | (amd64) valid program | Test Case: attached Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by imz): One difference is that without `-O1` it doesn't recompile `A.hs` when compiling `B.hs`, whereas with `-O1` it does (although superficially there is no extra reason to do so in the second case, i.e., no change in flags which might cause this: `A.hs` has been compiled with `-O1` already in the second case; it could be understood if `-O1` always caused recompilation, no matter what the previous flags were): {{{ removed 'A.o' ghc -Wall A.hs -main-is A.main -o a [1 of 1] Compiling A ( A.hs, A.o ) Linking a ... ghc -Wall B.hs -main-is B.main -o b [2 of 2] Compiling B ( B.hs, B.o ) [flags changed] Linking b ... ./A.o: In function `siv_closure': (.data+0x0): multiple definition of `__stginit_ZCMain' }}} vs {{{ removed 'A.o' ghc -Wall -O1 A.hs -main-is A.main -o a [1 of 1] Compiling A ( A.hs, A.o ) Linking a ... ghc -Wall -O1 B.hs -main-is B.main -o b [1 of 2] Compiling A ( A.hs, A.o ) [flags changed] [2 of 2] Compiling B ( B.hs, B.o ) [flags changed] Linking b ... }}} (success) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10531#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler