[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#290438: produces wrong code on i386 compiling with -fno-automatic -O1



Package: g77-3.3
Version: 1:3.3.5-6
Severity: normal


Hi,

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.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.27-1-k7
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages g77-3.3 depends on:
ii  gcc-3.3                     1:3.3.5-6    The GNU C compiler
ii  gcc-3.3-base                1:3.3.5-6    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libg2c0-dev                 1:3.3.5-6    GNU Fortran 77 library development

-- no debconf information

regards,

-- 
Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544

Attachment: test-g77-bug.tar.gz
Description: Binary data


Reply to: