Summary: | ICE on attempt to compile trivial Fortran program | ||
---|---|---|---|
Product: | gcc | Reporter: | al.danial <al.danial> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | d, dfranke, gcc-bugs |
Priority: | P3 | ||
Version: | unknown | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
al.danial@ngc.com
2009-07-13 17:19:11 UTC
Fortran reports are never anything but "normal". However, would you really expect that a compiler would be released that can't handle code like the one quoted? I find it hard to believe, especially on a platform as common as i686-pc-linux-gnu. Does the C-compiler work? Something like ... $> cat hello.c #include <stdio.h> int main() { printf("hello\n"); return 0; } $> gcc hello.c && ./a.out If not, I'd check configuration, compilation and installation. Try compiling without these: -lgfortranbegin -lgfortran Should not need to do this. Lets see what it does. (In reply to comment #1) > Fortran reports are never anything but "normal". > > However, would you really expect that a compiler would be released that can't > handle code like the one quoted? I find it hard to believe, especially on a > platform as common as i686-pc-linux-gnu. > > Does the C-compiler work? Something like ... > > $> cat hello.c > #include <stdio.h> > int main() { > printf("hello\n"); > return 0; > } > > $> gcc hello.c && ./a.out > > If not, I'd check configuration, compilation and installation. The C compiler works fine. Yes, I'm puzzled by the inability of gfortran to work at all. For what it's worth, I also built an x86_64 installation of 4.4.0 and on it gfortran works perfectly. My build procedure on the i686 machine is identical to the procedure for x86_64 (except for the obvious difference of pointing to 32 bit libraries instead of 64 bit for GMP and MPFR). I agree the problem is most likely on my end however I'm at a loss to figure out why. (In reply to comment #2) > Try compiling without these: > > > -lgfortranbegin -lgfortran > > Should not need to do this. Lets see what it does. I don't specify either of these options (or any others for that matter). The ICE is triggered with gfortran hello.f I'm not sure why the verbose invocation (gfortran -v -save-temps) claims I supply these: -lgfortranbegin -lgfortran -lm -shared-libgcc My guess would be you have configured libgmp or libmpfr for a different CPU than you really have. Try gdb --args /apps/gcc/4.4.0/libexec/gcc/i686-pc-linux-gnu/4.4.0/f951 hello.f run and see on which insn it crashed (disas $pc-32 $pc+32)? Another possibility is the binary got corrupted. (In reply to comment #5) > My guess would be you have configured libgmp or libmpfr for a different CPU > than you really have. Try > gdb --args /apps/gcc/4.4.0/libexec/gcc/i686-pc-linux-gnu/4.4.0/f951 hello.f > run > and see on which insn it crashed (disas $pc-32 $pc+32)? > > Another possibility is the binary got corrupted. > gdb --args /apps/gcc/4.4.0/libexec/gcc/i686-pc-linux-gnu/4.4.0/f951 hello.f GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) run Starting program: /apps/gcc/4.4.0/libexec/gcc/i686-pc-linux-gnu/4.4.0/f951 hello.f Program received signal SIGILL, Illegal instruction. 0x009c0cb9 in __gmpn_submul_1 () from /apps/gmp/4.2.2/lib/libgmp.so.3 (gdb) where #0 0x009c0cb9 in __gmpn_submul_1 () from /apps/gmp/4.2.2/lib/libgmp.so.3 #1 0x009cd5a2 in __gmpn_sb_divrem_mn () from /apps/gmp/4.2.2/lib/libgmp.so.3 #2 0x00000000 in ?? () (gdb) disas $pc-32 $pc+32 Dump of assembler code from 0x9c0c99 to 0x9c0cd9: 0x009c0c99 <__gmpn_submul_1+2>: leave 0x009c0c9a <__gmpn_submul_1+3>: mov 0x8(%esp),%eax 0x009c0c9e <__gmpn_submul_1+7>: pcmpeqd %mm0,%mm0 0x009c0ca1 <__gmpn_submul_1+10>: movd 0x10(%esp),%mm7 0x009c0ca6 <__gmpn_submul_1+15>: pcmpeqd %mm6,%mm6 0x009c0ca9 <__gmpn_submul_1+18>: mov 0x4(%esp),%edx 0x009c0cad <__gmpn_submul_1+22>: psrlq $0x20,%mm0 0x009c0cb1 <__gmpn_submul_1+26>: mov 0xc(%esp),%ecx 0x009c0cb5 <__gmpn_submul_1+30>: psllq $0x20,%mm6 0x009c0cb9 <__gmpn_submul_1+34>: psubq %mm0,%mm6 0x009c0cbc <__gmpn_submul_1+37>: psubq %mm1,%mm0 0x009c0cbf <__gmpn_submul_1+40>: movd (%eax),%mm1 0x009c0cc2 <__gmpn_submul_1+43>: lea 0x4(%eax),%eax 0x009c0cc5 <__gmpn_submul_1+46>: movd (%edx),%mm2 0x009c0cc8 <__gmpn_submul_1+49>: paddq %mm6,%mm2 0x009c0ccb <__gmpn_submul_1+52>: pmuludq %mm7,%mm1 0x009c0cce <__gmpn_submul_1+55>: psubq %mm1,%mm2 0x009c0cd1 <__gmpn_submul_1+58>: paddq %mm2,%mm0 0x009c0cd4 <__gmpn_submul_1+61>: sub $0x1,%ecx 0x009c0cd7 <__gmpn_submul_1+64>: movd %mm0,(%edx) End of assembler dump. (gdb) yeah, something with GMP. I'll rebuild it, then rebuild GCC 4.4.0, report what happens. One more data point: the build machine runs CentOS 4.3 and on it gfortran works fine (!). The ICE happens on a CentOS 4.4 box (using the identical GCC 4.4.0/GMP 4.2.2/MPFR 2.4.1 bits from a shared NFS mount). I'll mark this as an invalid GCC bug. Still baffled by the root cause of the problem though... |