
I've looked into this myself. I don't think it's actually anything wrong in gmp-wrappers. It's because CmmBuildInfoTables expects all the info tables in the (CmmProc info_tbls lbl g) to be defined in the graph g. But Jan's new optimisation to the stack overflow check (Note [Always false stack check] in CmmLayoutStack) ends up dropping a conditional branch, so a call to gc is eliminated, and hence a proc point is eliminated, and we end up with an unused thing in info_tbls, which confuses CmmBuildInfoTables Sigh. I don't know why this only happens on Windows. I'm looking into a fix Simon From: Simon Peyton-Jones Sent: 15 November 2013 22:18 To: ghc-devs@haskell.org Subject: bundle panic Windows build is failing again in a new way. It was fine a couple of days ago. Does this ring any bells? ghc-stage1.exe: panic! (the 'impossible' happened) (GHC version 7.7.20131107 for i386-unknown-mingw32): bundle Simon "inplace/bin/ghc-stage1.exe" -static -H32m -O -Werror -Wall -H64m -O0 -package-name integer-gmp-0.5.1.0 -hide-all-packages -i -ilibraries/integer-gmp/. -ilibraries/integer-gmp/dist-install/build -ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/dist-install/build -Ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/. -optP-include -optPlibraries/integer-gmp/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -Wall -package-name integer-gmp -XHaskell2010 -dcore-lint -no-user-package-db -rtsopts -Ilibraries/integer-gmp/mkGmpDerivedConstants/dist -c libraries/integer-gmp/cbits/gmp-wrappers.cmm -o libraries/integer-gmp/dist-install/build/cbits/gmp-wrappers.o ghc-stage1.exe: panic! (the 'impossible' happened) (GHC version 7.7.20131107 for i386-unknown-mingw32): bundle c8 integer_cmm_importIntegerFromByteArrayzh [(c8, label: block{v c8}_info rep:StackRep [False, True, True, True]), (cg, label: block{v cg}_info rep:StackRep [False, True, True, True])] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug HEAD (master)$

On 16/11/13 00:16, Simon Peyton-Jones wrote:
I’ve looked into this myself. I don’t think it’s actually anything wrong in gmp-wrappers. It’s because CmmBuildInfoTables expects all the info tables in the (CmmProc info_tbls lbl g) to be defined in the graph g.
But Jan’s new optimisation to the stack overflow check (Note [Always false stack check] in CmmLayoutStack) ends up dropping a conditional branch, so a call to gc is eliminated, and hence a proc point is eliminated, and we end up with an unused thing in info_tbls, which confuses CmmBuildInfoTables
Sigh. I don’t know why this only happens on Windows. I’m looking into a fix
Perhaps this is a problem that only shows up with proc points, which is
why you wouldn't see it on x86_64/Linux. Let me know if you get stuck
and I'll try to look into it.
FYI eliminating always-false stack checks is not new, it was temporarily
broken by:
commit 94125c97e49987e91fa54da6c86bc6d17417f5cf
Author: Jan Stolarek
Simon
*From:*Simon Peyton-Jones *Sent:* 15 November 2013 22:18 *To:* ghc-devs@haskell.org *Subject:* bundle panic
Windows build is failing again in a new way. It was fine a couple of days ago. Does this ring any bells?
ghc-stage1.exe: panic! (the 'impossible' happened)
(GHC version 7.7.20131107 for i386-unknown-mingw32):
bundle
Simon
"inplace/bin/ghc-stage1.exe" -static -H32m -O -Werror -Wall -H64m -O0 -package-name integer-gmp-0.5.1.0 -hide-all-packages -i -ilibraries/integer-gmp/. -ilibraries/integer-gmp/dist-install/build -ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/dist-install/build -Ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/. -optP-include -optPlibraries/integer-gmp/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -Wall -package-name integer-gmp -XHaskell2010 -dcore-lint -no-user-package-db -rtsopts -Ilibraries/integer-gmp/mkGmpDerivedConstants/dist -c libraries/integer-gmp/cbits/gmp-wrappers.cmm -o libraries/integer-gmp/dist-install/build/cbits/gmp-wrappers.o
ghc-stage1.exe: panic! (the 'impossible' happened)
(GHC version 7.7.20131107 for i386-unknown-mingw32):
bundle
c8 integer_cmm_importIntegerFromByteArrayzh [(c8,
label: block{v c8}_info
rep:StackRep [False, True, True, True]),
(cg,
label: block{v cg}_info
rep:StackRep [False, True, True, True])]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
HEAD (master)$
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

I don't see any commit fixing this so I assume that this is still relevant.
Perhaps this is a problem that only shows up with proc points, which is why you wouldn't see it on x86_64/Linux. Wouldn't this also break some of Mac builds? Besides, my change was commited a few weeks ago, while Simon says this didn't happen a few days before.
But Jan’s new optimisation to the stack overflow check (Note [Always false stack check] in CmmLayoutStack) ends up dropping a conditional branch, In theory my optimisation should not affect elimination of unnecessary branches in any way - this optimisation was there before. Note also that the last thing we do in Cmm pipeline is call to removeUnreachableBlocksProc so any unreachable block should be eliminated from the final graph - bundle is called later.
so a call to gc is eliminated A random guess: https://github.com/ghc/ghc/commit/ad0b943293cce74baf06ea36e1a4d51a3631dfdf This was commited two days before you reported the problem and is GC-related.
Janek Dnia niedziela, 17 listopada 2013, Simon Marlow napisał:
On 16/11/13 00:16, Simon Peyton-Jones wrote:
I’ve looked into this myself. I don’t think it’s actually anything wrong in gmp-wrappers. It’s because CmmBuildInfoTables expects all the info tables in the (CmmProc info_tbls lbl g) to be defined in the graph g.
But Jan’s new optimisation to the stack overflow check (Note [Always false stack check] in CmmLayoutStack) ends up dropping a conditional branch, so a call to gc is eliminated, and hence a proc point is eliminated, and we end up with an unused thing in info_tbls, which confuses CmmBuildInfoTables
Sigh. I don’t know why this only happens on Windows. I’m looking into a fix
Perhaps this is a problem that only shows up with proc points, which is why you wouldn't see it on x86_64/Linux. Let me know if you get stuck and I'll try to look into it.
FYI eliminating always-false stack checks is not new, it was temporarily broken by:
commit 94125c97e49987e91fa54da6c86bc6d17417f5cf Author: Jan Stolarek
Date: Wed Oct 16 09:45:56 2013 +0200 Generate (old + 0) instead of Sp in stack checks
and then fixed up by:
commit 1cf0c8ad321d1d358cbec46d35be02566faf2d00 Author: Jan Stolarek
Date: Thu Oct 17 23:17:06 2013 +0200 Optimise stack checks that are always false
Cheers, Simon
Simon
*From:*Simon Peyton-Jones *Sent:* 15 November 2013 22:18 *To:* ghc-devs@haskell.org *Subject:* bundle panic
Windows build is failing again in a new way. It was fine a couple of days ago. Does this ring any bells?
ghc-stage1.exe: panic! (the 'impossible' happened)
(GHC version 7.7.20131107 for i386-unknown-mingw32):
bundle
Simon
"inplace/bin/ghc-stage1.exe" -static -H32m -O -Werror -Wall -H64m -O0 -package-name integer-gmp-0.5.1.0 -hide-all-packages -i -ilibraries/integer-gmp/. -ilibraries/integer-gmp/dist-install/build -ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/dist-install/build -Ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/. -optP-include -optPlibraries/integer-gmp/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -Wall -package-name integer-gmp -XHaskell2010 -dcore-lint -no-user-package-db -rtsopts -Ilibraries/integer-gmp/mkGmpDerivedConstants/dist -c libraries/integer-gmp/cbits/gmp-wrappers.cmm -o libraries/integer-gmp/dist-install/build/cbits/gmp-wrappers.o
ghc-stage1.exe: panic! (the 'impossible' happened)
(GHC version 7.7.20131107 for i386-unknown-mingw32):
bundle
c8 integer_cmm_importIntegerFromByteArrayzh [(c8,
label: block{v c8}_info
rep:StackRep [False, True, True, True]),
(cg,
label: block{v cg}_info
rep:StackRep [False, True, True, True])]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
HEAD (master)$
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

I fixed this.
commit 3f0d4530a716b6db3c20b63825b56597e08b0d5e
Author: Simon Peyton Jones
participants (3)
-
Jan Stolarek
-
Simon Marlow
-
Simon Peyton-Jones