[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:

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.)

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.



More information about the Haskell-Cafe mailing list