POV-Ray : Newsgroups : povray.programming : GCC bug manifested in Colour Patch Server Time
29 Jul 2024 04:32:14 EDT (-0400)
  GCC bug manifested in Colour Patch (Message 1 to 2 of 2)  
From: Daren Scot Wilson
Subject: GCC bug manifested in Colour Patch
Date: 30 Nov 1998 12:16:06
Message: <36629AE0.933484D5@pipeline.com>
This isn't the right forum to discuss gcc bugs, but I don't want anyone
looking at my patch, wondering why there's this strange line in there,
thinking I'm insane.  Well, I mean, of course I *am* insane, just not
for that reason...   :-P


I made a discovery concerning the GNU C compiler - it has  a bug!   If
you look at the source code in my Colour Dispersion patch, you'll see a
line that goes

        strcat("A", 'a');

which accomplishes nothing, except that if it's removed and certain
compiler optimizations are turned on, POV-Ray will incorrectly render
refraction.  I hope to narrow POVRay down to a simple few-line test
program and pass it on to the GCC developers.  

The optimizations I used were:
   -O2 -mpentium -finline-functions

The problem goes away if (1) you change to -O1;  (2) your remove
-finline-functions; or (3) you insert an arbitrary call to a C library
function, such as printf or some string function, at a certain place in
the source code.

The gcc I use is version 2.8.1, compiled from source with pentium
optimizations.  I haven't even gotten as far as looking for the official
bug list for gcc.  


-- 

Daren Scot Wilson
Member, ACM
dar### [at] pipelinecom
www.newcolor.com
--
"A ship in a harbor is safe, but that is not what ships are built for"
                     -- William Shedd


Post a reply to this message

From: Dan Connelly
Subject: Re: GCC bug manifested in Colour Patch
Date: 2 Dec 1998 22:08:49
Message: <366600BF.E5E3C330@flash.net>
I would guess it's getting sloppy about optimizing register
utilization, or something similar.  The function call forces
it to save the contents before the call and reload them after,
I suspect.

Of interest is the statements surrounding this library function call,
not the call itself.  And the real proof is in the object code coming
out of the compiler.

Dan


Daren Scot Wilson wrote:
> 
> This isn't the right forum to discuss gcc bugs, but I don't want anyone
> looking at my patch, wondering why there's this strange line in there,
> thinking I'm insane.  Well, I mean, of course I *am* insane, just not
> for that reason...   :-P
> 
> I made a discovery concerning the GNU C compiler - it has  a bug!   If
> you look at the source code in my Colour Dispersion patch, you'll see a
> line that goes
> 
>         strcat("A", 'a');
> 
> which accomplishes nothing, except that if it's removed and certain
> compiler optimizations are turned on, POV-Ray will incorrectly render
> refraction.  I hope to narrow POVRay down to a simple few-line test
> program and pass it on to the GCC developers.
> 
> The optimizations I used were:
>    -O2 -mpentium -finline-functions

-- 
http://www.flash.net/~djconnel/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.