public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40994]  New: ICE with BIND(C)
@ 2009-08-07  8:17 jv244 at cam dot ac dot uk
  2009-08-07  9:15 ` [Bug fortran/40994] " jv244 at cam dot ac dot uk
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-08-07  8:17 UTC (permalink / raw)
  To: gcc-bugs

The following semi-invalid code ICEs (but compiles fine with ifort):

MODULE f03_test
 USE, INTRINSIC :: ISO_C_BINDING
 INTERFACE
    FUNCTION build(lib, np) BIND(C)
    END FUNCTION
 END INTERFACE
 PROCEDURE(build), POINTER               :: pbuild
CONTAINS
 SUBROUTINE test_asc()
 END SUBROUTINE test_asc
 SUBROUTINE test_bind_c BIND(C,name="test_bind_c")
 END SUBROUTINE test_bind_c
END MODULE f03_test
END


-- 
           Summary: ICE with BIND(C)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


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


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

* [Bug fortran/40994] ICE with BIND(C)
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
@ 2009-08-07  9:15 ` jv244 at cam dot ac dot uk
  2009-08-07  9:27 ` janus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-08-07  9:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jv244 at cam dot ac dot uk  2009-08-07 09:15 -------
for reference:

elete_root (t=0x1306d40) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/bbt.c:149
149       if (t->left->priority > t->right->priority)
(gdb) bt
#0  delete_root (t=0x1306d40) at
/data03/vondele/gcc_trunk/gcc/gcc/fortran/bbt.c:149
#1  0x00000000004a5bdf in gfc_delete_bbt (root=0x1306340, old=0x1306d40,
compare=0)
    at /data03/vondele/gcc_trunk/gcc/gcc/fortran/bbt.c:196
#2  0x0000000000524c73 in gfc_delete_symtree (root=0x1306340, name=0x12fe970
"")
    at /data03/vondele/gcc_trunk/gcc/gcc/fortran/symbol.c:2299
#3  0x0000000000524d27 in gfc_undo_symbols () at
/data03/vondele/gcc_trunk/gcc/gcc/fortran/symbol.c:2751
#4  0x00000000004fa2d5 in decode_statement () at
/data03/vondele/gcc_trunk/gcc/gcc/fortran/parse.c:268
#5  0x00000000004fb485 in next_statement () at
/data03/vondele/gcc_trunk/gcc/gcc/fortran/parse.c:708
#6  0x00000000004fea1a in gfc_parse_file () at
/data03/vondele/gcc_trunk/gcc/gcc/fortran/parse.c:3924
#7  0x0000000000532ead in gfc_be_parse_file (set_yydebug=<value optimized out>)
    at /data03/vondele/gcc_trunk/gcc/gcc/fortran/f95-lang.c:241
#8  0x0000000000800433 in toplev_main (argc=13, argv=0x7fff4b9e7a08) at
/data03/vondele/gcc_trunk/gcc/gcc/toplev.c:1026
#9  0x00007f094264a436 in __libc_start_main () from /lib64/libc.so.6
#10 0x000000000049e259 in _start ()


-- 


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


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

* [Bug fortran/40994] ICE with BIND(C)
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
  2009-08-07  9:15 ` [Bug fortran/40994] " jv244 at cam dot ac dot uk
@ 2009-08-07  9:27 ` janus at gcc dot gnu dot org
  2009-08-07 10:11 ` jv244 at cam dot ac dot uk
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-07  9:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-08-07 09:27 -------
Before the ICE one gets the error:

 SUBROUTINE test_bind_c BIND(C,name="test_bind_c")
                                                  1
Error: Missing required parentheses before BIND(C) at (1)

If this error is corrected, the ICE goes away.


-- 


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


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

* [Bug fortran/40994] ICE with BIND(C)
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
  2009-08-07  9:15 ` [Bug fortran/40994] " jv244 at cam dot ac dot uk
  2009-08-07  9:27 ` janus at gcc dot gnu dot org
@ 2009-08-07 10:11 ` jv244 at cam dot ac dot uk
  2010-04-18 15:49 ` dominiq at lps dot ens dot fr
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-08-07 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jv244 at cam dot ac dot uk  2009-08-07 10:11 -------
(In reply to comment #2)
> Before the ICE one gets the error:
> 
>  SUBROUTINE test_bind_c BIND(C,name="test_bind_c")
>                                                   1

that's why I called the testcase semi-invalid. Note that g95/ifort/NAG appear
to allow this (non-standard) variant. 


-- 


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


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

* [Bug fortran/40994] ICE with BIND(C)
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2009-08-07 10:11 ` jv244 at cam dot ac dot uk
@ 2010-04-18 15:49 ` dominiq at lps dot ens dot fr
  2010-04-23 20:17 ` jv244 at cam dot ac dot uk
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-04-18 15:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2010-04-18 15:49 -------
Still there on trunk -> should be marked as NEW.


-- 


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


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

* [Bug fortran/40994] ICE with BIND(C)
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2010-04-18 15:49 ` dominiq at lps dot ens dot fr
@ 2010-04-23 20:17 ` jv244 at cam dot ac dot uk
  2010-05-07 22:10 ` [Bug fortran/40994] ICE in gfc_undo_symbols dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2010-04-23 20:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jv244 at cam dot ac dot uk  2010-04-23 20:17 -------
as per comment #4, and reconfirmed for trunk


-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-23 20:17:34
               date|                            |


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


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

* [Bug fortran/40994] ICE in gfc_undo_symbols
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2010-04-23 20:17 ` jv244 at cam dot ac dot uk
@ 2010-05-07 22:10 ` dfranke at gcc dot gnu dot org
  2010-07-26 13:31 ` dominiq at lps dot ens dot fr
  2010-08-11 19:30 ` janus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-07 22:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2010-05-07 22:09 -------
Not related to ISO-C.

Reduced test case:
MODULE f03_test
 INTERFACE
    INTEGER FUNCTION build(lib, np)
    END FUNCTION
 END INTERFACE
 PROCEDURE(build), POINTER :: pbuild
CONTAINS
   XXXX                        ! simply generate any error
END MODULE f03_test

end


daniel@silence:~/pr$ valgrind
/home/daniel/i686-pc-linux-gnu/gcc/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951
pr40994.f90
==20641== Memcheck, a memory error detector
==20641== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==20641== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==20641== Command:
/home/daniel/i686-pc-linux-gnu/gcc/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951
pr40994.f90
==20641== 
pr40994.f90:10.50:

 SUBROUTINE test_bind_c BIND(C,name="test_bind_c")
                                                  1
Error: Missing required parentheses before BIND(C) at (1)
pr40994.f90:11.4:

 END SUBROUTINE test_bind_c
    1
Error: Expecting END MODULE statement at (1)
pr40994.f90:4.30-26:

    INTEGER FUNCTION build(lib, np) BIND(C)
                          2   1
Warning: Implicitly declared variable 'lib' at (1) may not be C interoperable
but it is a dummy argument to the BIND(C) procedure 'build' at (2)
pr40994.f90:4.34-26:

    INTEGER FUNCTION build(lib, np) BIND(C)
                          2       1
Warning: Implicitly declared variable 'np' at (1) may not be C interoperable
but it is a dummy argument to the BIND(C) procedure 'build' at (2)
pr40994.f90:4.26:

    INTEGER FUNCTION build(lib, np) BIND(C)
                          1
Warning: Variable 'build' at (1) may not be a C interoperable kind but it is
bind(c)
==20641== Invalid read of size 4
==20641==    at 0x81578A2: gfc_undo_symbols (symbol.c:2813)
==20641==    by 0x8125CE6: decode_statement (parse.c:271)
==20641==    by 0x81277D0: next_free (parse.c:722)
==20641==    by 0x8127BB9: next_statement (parse.c:907)
==20641==    by 0x812BD8D: gfc_parse_file (parse.c:4220)
==20641==    by 0x8167059: gfc_be_parse_file (f95-lang.c:239)
==20641==    by 0x8481F2A: compile_file (toplev.c:1053)
==20641==    by 0x4131BD5: (below main) (libc-start.c:226)
==20641==  Address 0x430a910 is 136 bytes inside a block of size 296 free'd
==20641==    at 0x4024B3A: free (vg_replace_malloc.c:366)
==20641==    by 0x815710F: gfc_free_symbol (symbol.c:2485)
==20641==    by 0x8157FEF: free_sym_tree (symbol.c:3087)
==20641==    by 0x81582AD: gfc_free_namespace (symbol.c:3231)
==20641==    by 0x81570C7: gfc_free_symbol (symbol.c:2476)
==20641==    by 0x8157FEF: free_sym_tree (symbol.c:3087)
==20641==    by 0x8157F5B: free_sym_tree (symbol.c:3068)
==20641==    by 0x8157F5B: free_sym_tree (symbol.c:3068)
==20641==    by 0x8157F5B: free_sym_tree (symbol.c:3068)
==20641==    by 0x8157F5B: free_sym_tree (symbol.c:3068)
==20641==    by 0x8157F5B: free_sym_tree (symbol.c:3068)
==20641==    by 0x81582AD: gfc_free_namespace (symbol.c:3231)
[...]


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
OtherBugsDependingO|32630                       |
              nThis|                            |
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
      Known to fail|4.4.1 4.5.0                 |4.4.1 4.5.0 4.6.0
            Summary|ICE with BIND(C)            |ICE in gfc_undo_symbols


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


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

* [Bug fortran/40994] ICE in gfc_undo_symbols
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2010-05-07 22:10 ` [Bug fortran/40994] ICE in gfc_undo_symbols dfranke at gcc dot gnu dot org
@ 2010-07-26 13:31 ` dominiq at lps dot ens dot fr
  2010-08-11 19:30 ` janus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-07-26 13:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dominiq at lps dot ens dot fr  2010-07-26 13:30 -------
This pr looks like a duplicate of pr37744, or at least the ICEs disappear with
-fwhole-file (now the default: see
http://gcc.gnu.org/ml/gcc-bugs/2010-07/msg02853.html#c9 ).


-- 


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


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

* [Bug fortran/40994] ICE in gfc_undo_symbols
  2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2010-07-26 13:31 ` dominiq at lps dot ens dot fr
@ 2010-08-11 19:30 ` janus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-11 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from janus at gcc dot gnu dot org  2010-08-11 19:30 -------
Both comment #0 and comment #6 work for me without ICE on 4.6 trunk r163095.
Closing as fixed.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.4.1 4.5.0 4.6.0           |4.4.1 4.5.0
      Known to work|                            |4.6.0
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-08-11 19:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-07  8:17 [Bug fortran/40994] New: ICE with BIND(C) jv244 at cam dot ac dot uk
2009-08-07  9:15 ` [Bug fortran/40994] " jv244 at cam dot ac dot uk
2009-08-07  9:27 ` janus at gcc dot gnu dot org
2009-08-07 10:11 ` jv244 at cam dot ac dot uk
2010-04-18 15:49 ` dominiq at lps dot ens dot fr
2010-04-23 20:17 ` jv244 at cam dot ac dot uk
2010-05-07 22:10 ` [Bug fortran/40994] ICE in gfc_undo_symbols dfranke at gcc dot gnu dot org
2010-07-26 13:31 ` dominiq at lps dot ens dot fr
2010-08-11 19:30 ` janus 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).