This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/35659] New: Miscompiled code with -O2 (but not with -O2 -funroll-loops) on ia64
- From: "kmccarty at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Mar 2008 18:48:59 -0000
- Subject: [Bug fortran/35659] New: Miscompiled code with -O2 (but not with -O2 -funroll-loops) on ia64
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
[This bug was initially submitted to the Debian BTS at
http://bugs.debian.org/466948 -- at the request of Debian's gcc maintainer, I
am also sending it here]
There is apparently a miscompilation of CERNLIB code in the "kernlib" library
on ia64 with gfortran-4.3 at optimization level -O2 or higher. (Oddly,
compiling with -O2 -funroll-loops does not expose the problem, which is why I
didn't notice it earlier.)
I've verified that this problem occurs on ia64 with gfortran-4.3 versions
4.3-20080202-1, 4.3-20080219-1 and 4.3.0. For the most recent trial:
(sid)kmccarty@merulo:~$ gfortran-4.3 -v
Using built-in specs.
Target: ia64-linux-gnu
Configured with: ../src/configure linux gnu
Thread model: posix
gcc version 4.3.1 20080309 (prerelease) (Debian 4.3.0-1)
Please see the complete test case I've provided at
http://people.debian.org/~kmccarty/tlsc-test-case.tar.gz
[Note, the files libkernlib.a and libkerngent.a in the tarball were compiled on
ia64 from CERNLIB source code, which is GPL; it is available from the Debian
source package of "cernlib" version 2006.dfsg.2-10]
[Note 2, I have updated this test case tarball to the gfortran version noted
above since I originally submitted this bug to the Debian BTS.]
The file tlsc.F in the test case is where the optimization bug happens. I
saved files tlsc.f, tlsc.s and tlsc.o into subdirectories of the test case for
three different combinations of compile flags:
-O2 (causes miscompiled code) in obj-fail subdir
-O0 (seems fine)
-O2 -funroll-loops (seems fine) both in obj-success subdir.
Also the output of the test case, saved as output.txt in each subdir.
You can regenerate all of these files with these three combinations of compiler
flags quickly with "make output".
The presence or absence of -fno-automatic on the gfortran command line (I
omitted it in all three cases) appears to make no difference.
best regards,
Kevin McCarty
--
Summary: Miscompiled code with -O2 (but not with -O2 -funroll-
loops) on ia64
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kmccarty at debian dot org
GCC build triplet: ia64-linux-gnu
GCC host triplet: ia64-linux-gnu
GCC target triplet: ia64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35659