Red Hat Bugzilla – Bug 21423
gcc 2.96 optimization bug
Last modified: 2007-04-18 12:30:03 EDT
This could be the same bug as #20580, but I am not really qualified to say,
so I'm submitting a separate report.
This bug came to light in the R language (see http://www.r-project.org and
R-base on Red Hat Powertools), causing the random number generator for the
Poisson distribution to misbehave. The bug manifests itself only when the
code is optimized.
I am attaching a small example program - abstracted from the R source code
- that reproduces the bug.
When compiled with gcc -lm, the output is
When compiled with gcc -lm -O2, the output is
If this works for you, a larger program is available that is much closer to
the original source.
Created attachment 5789 [details]
Example program to show bug
Actually, this is not related to #20580, but #21376 and seems to be fixed
by that patch as well. So if the patch gets accepted into CVS gcc, it will
be part of gcc-2.96-65 soon.