Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 98270 - Internal Compiler Error (ICE) with g77 frontend on both gcc-3.4.3 and gcc-3.4.4, amd64
Summary: Internal Compiler Error (ICE) with g77 frontend on both gcc-3.4.3 and gcc-3.4...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-07 13:11 UTC by Tom Fogal
Modified: 2005-08-19 14:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
log of requested libtool run (similar to before, but with --debug) (log,33.16 KB, text/plain)
2005-07-07 18:18 UTC, Tom Fogal
Details
fortran source that causes ICE. (readmajorcube.f,6.78 KB, text/plain)
2005-08-19 11:26 UTC, Tom Fogal
Details
included from readmajorcube.f (INTERP.FOR,7.26 KB, text/plain)
2005-08-19 11:26 UTC, Tom Fogal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Fogal 2005-07-07 13:11:09 UTC
Fairly standard fortran77 code. Some unused variable problems, but I tried
commenting those out and still get the ICE. The ICE happens to occur on a line
with just a single 'return' instruction, near the very end of the file; the only
thing following return is the last line, 'end'.

I have tried both gcc-3.4.3 and gcc-3.4.4 as installed by gentoo, as noted in
the summary. They were compiled with similar USE flags; gcc -v gives:

Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/specs
Configured with: /usr/ptmp/portage/gcc-3.4.4/work/gcc-3.4.4/configure
--enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.4
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include/g++-v3
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-nls --with-system-zlib --disable-checking --disable-werror
--disable-libunwind-exceptions --enable-multilib --disable-libgcj
--enable-languages=c,c++,f77 --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.4 (Gentoo 3.4.4, HTB-3.4.4-1.00, ssp-3.4.4-1.0, pie-8.7.8)

I did not 'diff' the "unrecognizable insn" message output between 3.4.3 and
3.4.4, but they appear to be the same. I could verify this easily if asked; I
have both compilers installed and can switch between them with ease.

GCC4 looks too complicated to get setup on this machine. If there are other
compiler revisions you would like me to try just ask.

Its been a little while since I've built this system, but I think it came from a
stage1 install, if that matters.

Reproducible: Always
Steps to Reproduce:
Run:

/bin/sh ../../libtool --mode=compile g77 -Wall -I../include/ -pedantic-errors -g
-O2 -c -o readmajorcube.lo `test -f 'readmajorcube.f' || echo './'`readmajorcube.f
 g77 -Wall -I../include/ -pedantic-errors -g -O2 -c readmajorcube.f  -fPIC -o
.libs/readmajorcube.o
Actual Results:  
/bin/sh ../../libtool --mode=compile g77 -Wall -I../include/ -pedantic-errors -g
-O2 -c -o readmajorcube.lo `test -f 'readmajorcube.f' || echo './'`readmajorcube.f
 g77 -Wall -I../include/ -pedantic-errors -g -O2 -c readmajorcube.f  -fPIC -o
.libs/readmajorcube.o
readmajorcube.f: In subroutine `readmajorcube':
In file included from readmajorcube.f:17:
readmajorcube.f:54: warning: unused variable 'z'
readmajorcube.f:54: warning: unused variable 'y'
readmajorcube.f:54: warning: unused variable 'x'
readmajorcube.f:53: warning: unused variable 'range_delta__'
readmajorcube.f:52: warning: unused variable 'range'
readmajorcube.f:47: warning: unused variable 'range_total__'
readmajorcube.f:46: warning: unused variable 'coorsys'
readmajorcube.f:44: warning: unused variable 'sltype'
readmajorcube.f:43: warning: unused variable 'fltype'
readmajorcube.f:37: warning: unused variable 'typecount'
readmajorcube.f:22: warning: unused variable 'question'
readmajorcube.f:21: warning: unused variable 'ans'
readmajorcube.f:17: warning: unused variable 'firstpass'
readmajorcube.f:176: error: unrecognizable insn:
(insn:HI 2741 2740 564 2 (set (reg/f:DI 826)
        (plus:DI (symbol_ref:DI ("array.0") [flags 0x2] <var_decl 0x2aaaaae3e1a0
array>)
            (reg:DI 827))) -1 (insn_list 2740 (nil))
    (expr_list:REG_DEAD (reg:DI 827)
        (expr_list:REG_EQUAL (const:DI (plus:DI (symbol_ref:DI ("array.0")
[flags 0x2] <var_decl 0x2aaaaae3e1a0 array>)
                    (const_int 16874992 [0x1017df0])))
            (nil))))
readmajorcube.f:176: internal compiler error: in extract_insn, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.

Expected Results:  
Compile the subroutine reporting only the warnings.

Portage 2.0.51.22-r1 (default-linux/amd64/2005.0, gcc-3.4.4,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r11 x86_64)
=================================================================
System uname: 2.6.11-gentoo-r11 x86_64 AMD Opteron(tm) Processor 246
Gentoo Base System version 1.6.12
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.9
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r8, 2.15.92.0.2-r10
sys-devel/libtool:   1.5.16, 1.5.18-r1
virtual/os-headers:  2.6.8.1-r4, 2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="YES"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirrors.tds.net/gentoo
http://www.ibiblio.org/pub/Linux/distributions/gentoo http://gentoo.oregonstate.edu"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/usr/ptmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acpi alsa amd64 atlas avi bash-completion berkdb bitmap-fonts
boundschecking bzlib cdr crypt cups curl debugger dvd dvdr dvdread encode f77
flac font-server fortran gd gif gpm graphviz gtk gtk2 imagemagick imlib ipv6
java jp2 jpeg libwww lzw lzw-tiff mad mikmod mmap mng motif mozilla mp3 mpeg
ncurses netcdf nocd nvidia offensive offsensive ogg oggvorbis openal opengl pam
pcre perl png posix python quicktime readline sdl shared sharedmem sockets spell
ssl svg tcltk tcpd tetex theora tiff truetype truetype-fonts type1-fonts usb
userlocales videos vorbis wmf wxwindows xml2 xosd xpm xprint xrandr xv xvid zlib
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 1 Tom Fogal 2005-07-07 14:07:07 UTC
Quick summary: libtool has an effect, and this only occurs w/ -O2 or higher.
Should have tried && included this in the original report; mea culpa.

It seems libtool has something to do with the ICE. I copied the relevant file
and its only include out of the build tree and tried running the following
command, which is similar to what the autotools-based build system does:

/home/tfogal/tmp/F77_Projects/libtool --mode=compile g77 -Wall -I../include/
-pedantic-errors -g -O2 -c -o readmajorcube.lo `test -f 'readmajorcube.f' ||
echo './'`readmajorcube.f

This will generate the ICE. Changing "-O2" to "-O1" makes the subroutine compile
fine. Also I tried compiling without libtool, as in:

g77 -Wall -I../include -pedantic-errors -g -O2 -c readmajorcube.f

and this does NOT produce the ICE, regardless of the level of optimization
specified (or not specified).
Comment 2 SpanKY gentoo-dev 2005-07-07 16:01:03 UTC
please run:

/home/tfogal/tmp/F77_Projects/libtool --debug --mode=compile g77 -Wall
-I../include/ -pedantic-errors -g -O2 -c -o readmajorcube.lo readmajorcube.f >& log

and then post the log as an attachment ... we'll try to narrow down the test case
Comment 3 Tom Fogal 2005-07-07 18:18:35 UTC
Created attachment 62873 [details]
log of requested libtool run (similar to before, but with --debug)
Comment 4 SpanKY gentoo-dev 2005-07-07 18:35:10 UTC
ok, the difference is that libtool appends -fPIC ... so try this and see if it
causes the same error:

g77 -Wall -I../include/ -pedantic-errors -g -O2 -c readmajorcube.f -fPIC -o
.libs/readmajorcube.o

if it does, try ripping out as much stuff from readmajorcube.f as possible and
still trigger the bug
Comment 5 SpanKY gentoo-dev 2005-08-19 10:15:11 UTC
get back to us
Comment 6 Tom Fogal 2005-08-19 11:26:21 UTC
Created attachment 66333 [details]
fortran source that causes ICE.
Comment 7 Tom Fogal 2005-08-19 11:26:42 UTC
Created attachment 66334 [details]
included from readmajorcube.f
Comment 8 Tom Fogal 2005-08-19 11:30:51 UTC
Sorry this took so long; I had forgotten about submitting this.  Thankfully
bugzilla emails me when someone makes a comment...

It had to do with both -fPIC and optimizations at and above -O2.  Lowering
optimizations and/or getting rid of -fPIC solves the problem.

I am sorry, but I do not have the time to track this down any more.  I have been
given permission to attach the source files to this bug; I don't think it
mentions licensing, but permission was granted to use it for the purposes of
finding and fixing gcc problems.
Comment 9 Jeremy Huddleston (RETIRED) gentoo-dev 2005-08-19 14:50:09 UTC
Please try to create a _minimal_ test case neccessary to trigger the bug.  Rip
out as much as you can, and make it just a single source file.