#3971: FFI callback segfaults on PPC
-------------------------------+--------------------------------------------
    Reporter:  wkahl           |        Owner:               
        Type:  bug             |       Status:  new          
    Priority:  normal          |    Milestone:  _|_          
   Component:  Compiler (FFI)  |      Version:  6.12.3       
    Keywords:                  |   Difficulty:               
          Os:  Linux           |     Testcase:               
Architecture:  powerpc         |      Failure:  Runtime crash
-------------------------------+--------------------------------------------

Comment(by Mikolaj):

 I've compiled 6.12.3 in uregistered mode and then compiled the modified
 CallBacker with "fvia-C -funregisterised -static". The results are the
 same: "got squareW" and then a segfault. Couldn't test more precisely,
 because now assertions fail in binaries compiled with -debug already with
 trivial code. Compilation is not possible with fvia-C and registered mode,
 so that's it.

 I've noticed some assembler is compiled by gcc even in unregistered mode,
 so if there are illegal instructions in this assembler, they are still
 there. I naively hoped everything is written in pure C... Some parts of
 the compilation log follow:


 {{{
 Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted
 by GHC version 6.12.1
 Using binary package database:
 /usr/local/lib/ghc-6.12.3/package.conf.d/package.cache
 hiding package base-3.0.3.2 to avoid conflict with later version
 base-4.2.0.2
 wired-in package ghc-prim mapped to ghc-
 prim-0.2.0.0-13014a61d1bede2dccfcb74a207c457e
 wired-in package integer-gmp mapped to integer-
 gmp-0.2.0.1-88f5d2ed86bd848c39089474706fa2f9
 wired-in package base mapped to
 base-4.2.0.2-19a4e0bca43a8b040f5fa06af2f7275d
 wired-in package rts mapped to builtin_rts
 wired-in package haskell98 mapped to
 haskell98-1.0.1.1-fe1d74491ea84387f77ab267ccd18114
 wired-in package template-haskell mapped to template-
 haskell-2.4.0.1-baf591d5102d871c9b9ab3f76a1ef428
 wired-in package dph-seq mapped to dph-
 seq-0.4.0-fb29786cf6c57b51c4925845642c3924
 wired-in package dph-par mapped to dph-
 par-0.4.0-e3b525c83d71c4b538adf092065ac467
 Hsc static flags: -funregisterised -static

 [...]

 *** Assembler:
 /usr/bin/gcc -I. -c /tmp/ghc10472_0/ghc10472_2.s -o CallBacker.o
 *** Deleting temp files:
 Deleting: /tmp/ghc10472_0/ghc10472_2.s /tmp/ghc10472_0/ghc10472_1.s
 /tmp/ghc10472_0/ghc10472_0.hc /tmp/ghc10472_0/ghc10472_0.s
 Upsweep completely successful.
 *** Deleting temp files:
 Deleting:
 link: linkables are ...
 LinkableM (Tue Jun 15 20:04:29 CEST 2010) main:Main
    [DotO CallBacker.o, DotO CallBacker_stub.o]
 Linking CallBacker ...
 *** Linker:
 /usr/bin/gcc -v -o CallBacker CallBacker.o CallBacker_stub.o callerback.o
 -L/usr/local/lib/ghc-6.12.3/base-4.2.0.2 -L/usr/local/lib/ghc-6.12.3
 /integer-gmp-0.2.0.1 -L/usr/local/lib/ghc-6.12.3/ghc-prim-0.2.0.0
 -L/usr/local/lib/ghc-6.12.3 -lHSrtsmain -lHSbase-4.2.0.2 -lHSinteger-
 gmp-0.2.0.1 -lgmp -lHSghc-prim-0.2.0.0 -lHSrts -lm -lrt -ldl -u
 ghczmprim_GHCziTypes_Izh_static_info -u
 ghczmprim_GHCziTypes_Czh_static_info -u
 ghczmprim_GHCziTypes_Fzh_static_info -u
 ghczmprim_GHCziTypes_Dzh_static_info -u base_GHCziPtr_Ptr_static_info -u
 base_GHCziWord_Wzh_static_info -u base_GHCziInt_I8zh_static_info -u
 base_GHCziInt_I16zh_static_info -u base_GHCziInt_I32zh_static_info -u
 base_GHCziInt_I64zh_static_info -u base_GHCziWord_W8zh_static_info -u
 base_GHCziWord_W16zh_static_info -u base_GHCziWord_W32zh_static_info -u
 base_GHCziWord_W64zh_static_info -u base_GHCziStable_StablePtr_static_info
 -u ghczmprim_GHCziTypes_Izh_con_info -u ghczmprim_GHCziTypes_Czh_con_info
 -u ghczmprim_GHCziTypes_Fzh_con_info -u ghczmprim_GHCziTypes_Dzh_con_info
 -u base_GHCziPtr_Ptr_con_info -u base_GHCziPtr_FunPtr_con_info -u
 base_GHCziStable_StablePtr_con_info -u ghczmprim_GHCziBool_False_closure
 -u ghczmprim_GHCziBool_True_closure -u
 base_GHCziPack_unpackCString_closure -u
 base_GHCziIOziException_stackOverflow_closure -u
 base_GHCziIOziException_heapOverflow_closure -u
 base_ControlziExceptionziBase_nonTermination_closure -u
 base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -u
 base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -u
 base_ControlziExceptionziBase_nestedAtomically_closure -u
 base_GHCziWeak_runFinalizzerBatch_closure -u
 base_GHCziTopHandler_runIO_closure -u
 base_GHCziTopHandler_runNonIO_closure -u
 base_GHCziConc_ensureIOManagerIsRunning_closure -u
 base_GHCziConc_runSparks_closure -u base_GHCziConc_runHandlers_closure
 -lHSffi
 Using built-in specs.
 Target: powerpc-linux-gnu
 Configured with: ../src/configure -v --with-pkgversion='Ubuntu
 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
 --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-
 shared --enable-multiarch --enable-linker-build-id --with-system-zlib
 --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
 --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4
 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin
 --enable-objc-gc --disable-softfloat --enable-secureplt --enable-targets
 =powerpc-linux,powerpc64-linux --with-cpu=default32 --disable-werror
 --with-long-double-128 --enable-checking=release --build=powerpc-linux-gnu
 --host=powerpc-linux-gnu --target=powerpc-linux-gnu

 [...]
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3971#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to