
#8834: 64-bit windows cabal.exe segfaults in GC
----------------------------------+----------------------------------
Reporter: awson | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc2
Resolution: | Keywords:
Operating System: Windows | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
----------------------------------+----------------------------------
Comment (by thoughtpolice):
Okay, I spent some time boiling some things down, and I've at least
determined the approximate location of the segfault in the code during
compilation, which is `stmtToInstrs` in
`compiler/nativeGen/X86/CodeGen.hs`. Here's just a quick dump (to not
loose findings) and I'll keep looking around.
The fault is when compiling `System.Time` in profiling. Run under gdb:
{{{
$ gdb --args "inplace/bin/ghc-stage2.exe" -v3 -hisuf p_hi -osuf p_o
-hcsuf p_hc -static -prof -H32m -O -package-name old-time-1.i
-ilibraries/old-time/. -ilibraries/old-time/dist-install/build -ilibraries
/old-time/dist-install/build/autogen -Ilibraries/old-timearies/old-time
/dist-install/build/autogen -Ilibraries/old-time/include -optP-include
-optPlibraries/old-time/dist-install/build/auage base-4.7.0.0 -package
old-locale-1.0.0.6 -Wall -XHaskell2010 -O2 -no-user-package-db -rtsopts
-odir libraries/old-time/distaries/old-time/dist-install/build -stubdir
libraries/old-time/dist-install/build -c libraries/old-time/dist-
install/build/System/Tie/dist-install/build/System/Time.p_o +RTS -DS
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-msys".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named libstdcxx.v6.printers
/etc/gdbinit:6: Error in sourced command file:
Error while executing Python code.
Reading symbols from /home/Administrator/ghc/inplace/bin/ghc-
stage2.exe...done.
warning: File "/home/Administrator/ghc/.gdbinit" auto-loading has been
declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-
load".
To enable execution of this file add
add-auto-load-safe-path /home/Administrator/ghc/.gdbinit
line to your configuration file "/home/Administrator/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/Administrator/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the
shell:
info "(gdb)Auto-loading safe path"
(gdb) load .gdbinit
You can't do that when your target is `exec'
(gdb) source .gdbinit
(gdb) r
Starting program: /home/Administrator/ghc/inplace/bin/ghc-stage2.exe -v3
-hisuf p_hi -osuf p_o -hcsuf p_hc -static -prof -H32m -O -package-name
old-time-1.1.0.2 -hide-all-packages -i -ilibraries/old-time/. -ilibraries
/old-time/dist-install/build -ilibraries/old-time/dist-
install/build/autogen -Ilibraries/old-time/dist-install/build -Ilibraries
/old-time/dist-install/build/autogen -Ilibraries/old-time/include -optP-
include -optPlibraries/old-time/dist-install/build/autogen/cabal_macros.h
-package base-4.7.0.0 -package old-locale-1.0.0.6 -Wall -XHaskell2010 -O2
-no-user-package-db -rtsopts -odir libraries/old-time/dist-install/build
-hidir libraries/old-time/dist-install/build -stubdir libraries/old-time
/dist-install/build -c libraries/old-time/dist-
install/build/System/Time.hs -o libraries/old-time/dist-
install/build/System/Time.p_o +RTS -DS
[New Thread 1136.0xcc8]
cc8: cap 0: initialised
[New Thread 1136.0x15e8]
[New Thread 1136.0x1658]
[New Thread 1136.0x11b8]
[New Thread 1136.0x11e8]
[New Thread 1136.0x1718]
Glasgow Haskell Compiler, Version 7.9.20140329, stage 2 booted by GHC
version 7.6.3
Using binary package database:
C:\Users\Administrator\Desktop\msys32\home\Administrator\ghc\inplace\lib\package.conf.d\package.cache
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-inplace
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-inplace
wired-in package base mapped to base-4.7.0.0-inplace
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-
haskell-2.10.0.0-inplace
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags:
*** Checking old interface for old-time-1.1.0.2:System.Time:
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size of Desugar (after optimization)
= {terms: 5,701, types: 3,843, coercions: 29}
...
*** Tidy Core:
Result size of Tidy Core
= {terms: 15,413, types: 10,079, coercions: 582}
Created temporary directory:
C:\Users\Administrator\Desktop\msys32\tmp\ghc1136_0
*** CorePrep:
Result size of CorePrep
= {terms: 18,936, types: 12,028, coercions: 582}
*** Stg2Stg:
*** CodeOutput:
*** New CodeGen:
*** CPSZ:
*** CPSZ:
*** CPSZ:
*** CPSZ:
*** CPSZ:
Program received signal SIGSEGV, Segmentation fault.
0x02137032 in c1hhA_info ()
(gdb) bt
#0 0x02137032 in c1hhA_info ()
Cannot access memory at address 0x28a874
(gdb) disassemble
Dump of assembler code for function c1hhA_info:
0x02137024 <+0>: sub $0x3510,%esp
0x0213702a <+6>: mov 0x8(%ebp),%eax
0x0213702d <+9>: mov 0x4(%ebp),%ecx
0x02137030 <+12>: mov %esi,%edx
=> 0x02137032 <+14>: mov %eax,0x184(%esp)
0x02137039 <+21>: mov -0x1(%edx),%eax
0x0213703c <+24>: movzwl -0x2(%eax),%eax
0x02137040 <+28>: cmp $0x1e,%eax
0x02137043 <+31>: ja 0x214916f