[forwarded from http://bugs.debian.org/290438]
seen with 2.95.4, 3.3.6, 3.4.3. I'm unable to reproduce the ICE mentioned below. The libraries mentioned are from cernlib 2004.11.04. Matthias The bug submitter writes: I have tracked down a bug report I was sent about libmathlib1 to a compiler optimization problem in g77 on i386. Please see the attached file for a test case. (Gunzip and un-tar it, cd into the resulting directory, and run "make" on a system with g77, make, libmathlib1-dev, libpacklib1-dev, and libkernlib1-dev packages installed.) The test case calculates the value of the triple integral of (sin(x)*sin(y)*sin(z))^2 with all three limits going from 1.d-8 to pi, whose value is equal to a tiny amount less than (pi^3)/8. (The setup is done in test.f and the main work in radmul.f, which comes from Cernlib source code.) The program prints out the numerical value of the integral, percent estimated error, number of iterations, and returned error flag. When the file radmul.f is compiled with g77 -O0 -fno-automatic flags, or just with -O1 flag, the following correct output is produced: calling dadmul I= 3.87578459+- 7.11202394E-12% 495 evals error 0 When the flags -fno-automatic -O1 (or higher) are given, the output is quite wrong: calling dadmul I= 42336.3332+- 2.45015127% 999999 evals error 1 If lines 10 and 11 of test.f are changed to set A(1) and A(2) [the lower bounds of integration] to 0.d0 instead of 1.d-8, the output with -fno-automatic -O1 is no longer outrageously large, but it still has a lot of error: calling dadmul I= 3.87588078+- 0.000990792397% 18315 evals error 0 The above behavior is that of g77-3.3 and g77-2.95. g77-3.4 does even worse. It produces the same result as g77-3.3 for the -fno-automatic -O1 case. Furthermore, when g77-3.4 is called with only -O1 (no -fno-automatic flag), the resulting program segfaults. (Run the attached testcase with "make F77=g77-3.4" to see.) For the three arches I've tested, these problems occur only on i386, not on powerpc nor on sparc. You may wish to clone this report to g77-3.4 and g77-2.95. I owe thanks to Eduardo A. Menendez Proupin for finding this bug, tracking down which Cernlib source code file it came from, and composing the test case. -- Summary: wrong code on i486 compiling with f77 -fno-automatic -O1 Product: gcc Version: 3.3.6 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: debian-gcc at lists dot debian dot org CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i486-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19469