[GHC] #2983: Segmentation fault in ray tracer with certain options

GHC trac at galois.com
Wed Jan 28 03:19:52 EST 2009


#2983: Segmentation fault in ray tracer with certain options
----------------------------------+-----------------------------------------
Reporter:  thoughtpolice          |          Owner:          
    Type:  bug                    |         Status:  new     
Priority:  normal                 |      Component:  Compiler
 Version:  6.10.1                 |       Severity:  normal  
Keywords:  seg fault, ray tracer  |       Testcase:          
      Os:  MacOS X                |   Architecture:  x86     
----------------------------------+-----------------------------------------
 The attached program, RayT.hs, when compiled like so can be executed
 normally:

 {{{
 $ ghc --make -O2 -funbox-strict-fields RayT.hs
 [1 of 1] Compiling Main             ( RayT.hs, RayT.o )

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `*'
     In the instance declaration for `Num Vector'

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `abs'
     In the instance declaration for `Num Vector'

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `signum'
     In the instance declaration for `Num Vector'
 Linking RayT ...
 $ ./RayT 9 512 > test.png
 $ file test.png
 test.png: Netpbm PGM "rawbits" image data
 $
 }}}

 But when compiled with these options, it seg faults:

 {{{
 $ ghc --make RayT.hs -O2 -fvia-C -funbox-strict-fields -optc-O3 -fexcess-
 precision -optc-ffast-math -funfolding-keeness-factor=10
 [1 of 1] Compiling Main             ( RayT.hs, RayT.o )

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `*'
     In the instance declaration for `Num Vector'

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `abs'
     In the instance declaration for `Num Vector'

 RayT.hs:7:9:
     Warning: No explicit method nor default method for `signum'
     In the instance declaration for `Num Vector'
 Linking RayT ...
 $ ./RayT 9 512 > test.png
 zsh: segmentation fault  ./RayT 9 512 > test.png
 $ gdb RayT
 GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC
 2008)
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i386-apple-darwin"...Reading symbols for
 shared libraries ... done

 (gdb) start 9 512
 Breakpoint 1 at 0x521e2
 Starting program: /Users/austinseipp/code/lhc/lhc-
 head/regress/tests/2_language/RayT 9 512
 Reading symbols for shared libraries ++. done

 Breakpoint 1, 0x000521e2 in main ()
 (gdb) continue
 Continuing.
 P5
 512 512
 255

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: 13 at address: 0x00000000
 0x00002fc9 in s367_info ()
 (gdb) backtrace
 #0  0x00002fc9 in s367_info ()
 #1  0x00000000 in ?? ()
 (gdb)
 $
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2983>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list