public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31971]  New: Simple Fortran code fails with ICE
@ 2007-05-17 10:49 magnus_os at yahoo dot se
  2007-05-17 15:05 ` [Bug fortran/31971] " kargl at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: magnus_os at yahoo dot se @ 2007-05-17 10:49 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]

gfortran-43 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gcc-43
--program-suffix=-43 --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.0 20070517 (experimental)

gfortran-43 -save-temps -c test.for
test.for: In function ‘xyz’:
test.for:1: internal compiler error: Illegal instruction

"-save-temps" does not return any meaningful output.

A simple oiece of code that reproduces this problem follows below. Delete the
IF-statement and there's no longer any ICE.



      SUBROUTINE XYZ( XY, KPT )
C
      IMPLICIT DOUBLE PRECISION ( A - H, O - Z ), INTEGER ( I - N )
C
      DIMENSION XY(*)
C
      I = 0
      DO 6000 JP = 1, 10
         ABC = XY( JP )
         IF ( ABC .GT. 0.0D0 )  THEN
C
            DO 300 KK = 1, KPT
               I = I + 1
 300        CONTINUE
C
         END IF
C
 6000 CONTINUE
C
      RETURN
      END


-- 
           Summary: Simple Fortran code fails with ICE
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: magnus_os at yahoo dot se


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
@ 2007-05-17 15:05 ` kargl at gcc dot gnu dot org
  2007-05-18  4:41 ` magnus_os at yahoo dot se
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-05-17 15:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2007-05-17 16:05 -------
Works for me.  What OS are you using and where did you get
the version of gfortran?  An illegal instruction error 
normally means you are using a version of gfortran on the
wrong architecture (ie., i686 on amd64).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
  2007-05-17 15:05 ` [Bug fortran/31971] " kargl at gcc dot gnu dot org
@ 2007-05-18  4:41 ` magnus_os at yahoo dot se
  2007-05-18  6:05 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: magnus_os at yahoo dot se @ 2007-05-18  4:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from magnus_os at yahoo dot se  2007-05-18 05:41 -------
The OS is Fedora 6. The compiler was generated from source after doing a "svn
update". I made sure that no previous object code was present before
rebuilding. The CPU is a 32-bit AMD 3000.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
  2007-05-17 15:05 ` [Bug fortran/31971] " kargl at gcc dot gnu dot org
  2007-05-18  4:41 ` magnus_os at yahoo dot se
@ 2007-05-18  6:05 ` jvdelisle at gcc dot gnu dot org
  2007-05-22 11:36 ` fxcoudert at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-18  6:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-05-18 07:05 -------
I have Fedora 6 on x86-64.  Works OK here.  However, we have a leak.  From
valgrind:

==19184== 9,288 (1,264 direct, 8,024 indirect) bytes in 2 blocks are definitely
lost in loss record 4 of 9
==19184==    at 0x4A05879: malloc (vg_replace_malloc.c:149)
==19184==    by 0xA276F7: xmalloc (xmalloc.c:147)
==19184==    by 0x43B194: gfc_getmem (misc.c:38)
==19184==    by 0x45D269: gfc_get_namespace (symbol.c:1867)
==19184==    by 0x45D39C: gfc_symbol_init_2 (symbol.c:2666)
==19184==    by 0x43AE88: gfc_init_2 (misc.c:261)
==19184==    by 0x44656A: gfc_parse_file (parse.c:3184)
==19184==    by 0x4653AD: gfc_be_parse_file (f95-lang.c:303)
==19184==    by 0x681183: toplev_main (toplev.c:1051)
==19184==    by 0x35E2A1DA43: (below main) (in /lib64/libc-2.5.so)
==19184== 
==19184== LEAK SUMMARY:
==19184==    definitely lost: 1,264 bytes in 2 blocks.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (2 preceding siblings ...)
  2007-05-18  6:05 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-22 11:36 ` fxcoudert at gcc dot gnu dot org
  2007-05-22 11:40 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-22 11:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-05-22 12:36 -------
(In reply to comment #2)
> The OS is Fedora 6.

No ICE for me on i686 with Fedora Core 6. I suspect this will be hard to
reproduce. Could you provide us with a backtrace, by doing the following:

  1. run gfortran with -v: gfortran-43 -v -save-temps -c test.for
  2. in the output generated, look at the line right after the version line
(ie, the line after "gcc version 4.3.0 20070517 (experimental)"). This is a
long line, that runs an executable called f951 and located in
${installdir}/libexec/gcc/i686-pc-linux-gnu/4.3.0
  3. Run this executable, with all the arguments, prefixed with "gdb -args".
That will give something like:

gdb -args
/tmpdir/opt/gfortran/gfortran-20070522/bin/../libexec/gcc/i386-pc-linux-gnu/4.3.0/f951
a.for -ffixed-form -quiet -dumpbase a.for -mtune=i386 -auxbase a -version
-fintrinsic-modules-path
/tmpdir/opt/gfortran/gfortran-20070522/bin/../lib/gcc/i386-pc-linux-gnu/4.3.0/finclude
-o /tmp/ccUoun2p.s

  4. When the "illegal instruction" error happens in gdb, type (at the gdb
prompt) "where". Post the output of that command here.

Thanks for your help!


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (3 preceding siblings ...)
  2007-05-22 11:36 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-22 11:40 ` fxcoudert at gcc dot gnu dot org
  2007-05-22 15:38 ` magnus_os at yahoo dot se
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-22 11:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-05-22 12:40 -------
(In reply to comment #3)
> I have Fedora 6 on x86-64.  Works OK here.  However, we have a leak.

Well, the leak is also triggered by the simple following two lines:
      SUBROUTINE XYZ
      END

==10212== 1,012 (860 direct, 152 indirect) bytes in 1 blocks are definitely
lost in loss record 3 of 7
==10212==    at 0x4005400: malloc (vg_replace_malloc.c:149)
==10212==    by 0x847685A: xmalloc (xmalloc.c:147)
==10212==    by 0xBEC3F66F: ???


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (4 preceding siblings ...)
  2007-05-22 11:40 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-22 15:38 ` magnus_os at yahoo dot se
  2007-05-22 15:46 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: magnus_os at yahoo dot se @ 2007-05-22 15:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from magnus_os at yahoo dot se  2007-05-22 16:38 -------
I've reproduced the problem on the official 2007-05-18 snapshot. This backtrace
is from that:


Program received signal SIGILL, Illegal instruction.
0x086b7d19 in mpfr_ceil_double ()
(gdb) where
#0  0x086b7d19 in mpfr_ceil_double ()
#1  0x086b7dd2 in mpfr_get_str_compute_g ()
#2  0x086b8160 in mpfr_get_str ()
#3  0x0829cb6e in real_from_mpfr (r=0xbf9a8af0, m=0x9c1dc4c, type=0xb7c81b64, 
    rndmode=GMP_RNDN) at ../../gcc-4.3-20070518/gcc/real.c:5045
#4  0x080c2c36 in gfc_conv_mpfr_to_tree (f=0x9c1dc4c, kind=8)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-const.c:186
#5  0x080c30c5 in gfc_conv_constant_to_tree (expr=0x9c1dc18)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-const.c:233
#6  0x080c315a in gfc_conv_constant (se=0xbf9a8cfc, expr=0x9c1dc18)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-const.c:295
#7  0x080d0a1c in gfc_conv_expr (se=0xbf9a8cfc, expr=0x9c1dc18)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-expr.c:3157
#8  0x080d0cbb in gfc_conv_expr (se=0xbf9a8da8, expr=0x9c1dc70)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-expr.c:1142
#9  0x080d3003 in gfc_conv_expr_val (se=0xbf9a8da8, expr=0x402a0000)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-expr.c:3206
#10 0x080ea997 in gfc_trans_if_1 (code=0x9c1daa0)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-stmt.c:588
#11 0x080b44c5 in gfc_trans_code (code=0x9c1dcc8)
    at ../../gcc-4.3-20070518/gcc/fortran/trans.c:614
#12 0x080ec3d0 in gfc_trans_do (code=0x9c1d770)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-stmt.c:750
#13 0x080b44a3 in gfc_trans_code (code=0x9c1d770)
    at ../../gcc-4.3-20070518/gcc/fortran/trans.c:622
#14 0x080ca013 in gfc_generate_function_code (ns=0x9be2940)
    at ../../gcc-4.3-20070518/gcc/fortran/trans-decl.c:3183
#15 0x0808d6cf in gfc_parse_file ()
    at ../../gcc-4.3-20070518/gcc/fortran/parse.c:3264
#16 0x080ae52d in gfc_be_parse_file (set_yydebug=0)
    at ../../gcc-4.3-20070518/gcc/fortran/f95-lang.c:303
#17 0x08300148 in toplev_main (argc=14, argv=0xbf9a90e4)
    at ../../gcc-4.3-20070518/gcc/toplev.c:1051
#18 0x080f20df in main (argc=Cannot access memory at address 0x1
) at ../../gcc-4.3-20070518/gcc/main.c:35


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (5 preceding siblings ...)
  2007-05-22 15:38 ` magnus_os at yahoo dot se
@ 2007-05-22 15:46 ` fxcoudert at gcc dot gnu dot org
  2007-05-22 16:23 ` magnus_os at yahoo dot se
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-22 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from fxcoudert at gcc dot gnu dot org  2007-05-22 16:46 -------
(In reply to comment #6)
> I've reproduced the problem on the official 2007-05-18 snapshot.

Can you reproduce it with the binaries available from the following link?
http://quatramaran.ens.fr/~coudert/gfortran/gfortran-i686-linux-20070518.tar.gz

> Program received signal SIGILL, Illegal instruction.
> 0x086b7d19 in mpfr_ceil_double ()
> (gdb) where
> #0  0x086b7d19 in mpfr_ceil_double ()
> #1  0x086b7dd2 in mpfr_get_str_compute_g ()
> #2  0x086b8160 in mpfr_get_str ()
> #3  0x0829cb6e in real_from_mpfr (r=0xbf9a8af0, m=0x9c1dc4c, type=0xb7c81b64, 
>     rndmode=GMP_RNDN) at ../../gcc-4.3-20070518/gcc/real.c:5045

It looks pretty much like a MPFR miscompilation to me. Do you use the GMP/MPFR
libraries provided by the Fedora project, or do you use custom-made? In the
later case, did you run "make check" after compiling them?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (6 preceding siblings ...)
  2007-05-22 15:46 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-22 16:23 ` magnus_os at yahoo dot se
  2007-05-22 16:33 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: magnus_os at yahoo dot se @ 2007-05-22 16:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from magnus_os at yahoo dot se  2007-05-22 17:22 -------
I downloaded the binaries, and no problems with those.

gfortran -v
Using built-in specs.
Target: i386-pc-linux-gnu
Configured with: /home/fxcoudert/gfortran_nightbuild/trunk/configure
--prefix=/home/fxcoudert/gfortran_nightbuild/irun-20070518
--enable-languages=c,fortran --disable-decimal-float --build=i386-pc-linux-gnu
--enable-checking=release
--with-gmp=/home/fxcoudert/gfortran_nightbuild/software
Thread model: posix
gcc version 4.3.0 20070518 (experimental)



I use the GMP/MPFR libraries from Fedora 6. No other installation of MPFR has
been done.

cksum /usr/lib/libmpfr.a
1197190056 378788 /usr/lib/libmpfr.a

Compiling the test code with the Fedora gfortran 4.1.1 compiler also works
without problems.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (7 preceding siblings ...)
  2007-05-22 16:23 ` magnus_os at yahoo dot se
@ 2007-05-22 16:33 ` fxcoudert at gcc dot gnu dot org
  2007-05-22 18:47 ` magnus_os at yahoo dot se
  2007-05-22 18:50 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-22 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from fxcoudert at gcc dot gnu dot org  2007-05-22 17:33 -------
(In reply to comment #8)
> I use the GMP/MPFR libraries from Fedora 6. No other installation of MPFR has
> been done.

Hum, that's more than probably it: FC6 has a GMP which contained an older
version of MPFR. The "Prerequisites for GCC" webpage
(http://gcc.gnu.org/install/prerequisites.html) says:

"MPFR Library version 2.2.1 (or later).  Necessary to build GCC. It can be
downloaded from http://www.mpfr.org/.  The version of MPFR that is bundled with
GMP 4.1.x contains numerous bugs."

I strongly suggest that you compile a newer MPFR, like 2.2.1.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (8 preceding siblings ...)
  2007-05-22 16:33 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-22 18:47 ` magnus_os at yahoo dot se
  2007-05-22 18:50 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: magnus_os at yahoo dot se @ 2007-05-22 18:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from magnus_os at yahoo dot se  2007-05-22 19:47 -------
Installing MPFR 2.2.1-p5 helped. gfortran doesn't fail anymore. Thanks


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/31971] Simple Fortran code fails with ICE
  2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
                   ` (9 preceding siblings ...)
  2007-05-22 18:47 ` magnus_os at yahoo dot se
@ 2007-05-22 18:50 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2007-05-22 19:50 -------
Not a GCC/Gfortran bug so closing as works for me.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31971


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-05-22 18:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-17 10:49 [Bug fortran/31971] New: Simple Fortran code fails with ICE magnus_os at yahoo dot se
2007-05-17 15:05 ` [Bug fortran/31971] " kargl at gcc dot gnu dot org
2007-05-18  4:41 ` magnus_os at yahoo dot se
2007-05-18  6:05 ` jvdelisle at gcc dot gnu dot org
2007-05-22 11:36 ` fxcoudert at gcc dot gnu dot org
2007-05-22 11:40 ` fxcoudert at gcc dot gnu dot org
2007-05-22 15:38 ` magnus_os at yahoo dot se
2007-05-22 15:46 ` fxcoudert at gcc dot gnu dot org
2007-05-22 16:23 ` magnus_os at yahoo dot se
2007-05-22 16:33 ` fxcoudert at gcc dot gnu dot org
2007-05-22 18:47 ` magnus_os at yahoo dot se
2007-05-22 18:50 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).