[Haskell-cafe] Glome raytracer bug: bad output with -O2 -fasm

Jim Snow jsnow at cs.pdx.edu
Fri Mar 28 02:28:42 EDT 2008


I was trying to get Blinn highlights working with my raytracer, and kept 
getting ugly artifacts.  After trying a bunch of things, I finally 
compiled without -O2, and the artifacts went away.

Here's what I mean:
http://syn.cs.pdx.edu/~jsnow/glome/Glome.hs-noartifact.png
http://syn.cs.pdx.edu/~jsnow/glome/Glome.hs-artifact.png

Here's the offending code, run "./make" and "./run" and you should see 
the artifacts if your setup is the same as mine. (Requires OpenGL.)
http://syn.cs.pdx.edu/~jsnow/glome/glome.hs-0.2-bug.tar.gz

The artifacts also go away if I use -fvia-C.  It doesn't seem to matter 
whether I use Floats or Doubles in the rendering code.  The artifacts 
also show up with -O1.  Have I stumbled across a known compiler bug?  Or 
perhaps an OpenGL bug?  (The bug could, of course, be in my code, but 
then one might expect to get the same erroneous output every time 
regardless of compiler flags.)

To reiterate, I'm using ghc 8.6.2.

thanks,

-jim


More information about the Haskell-Cafe mailing list