public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32464]  New: ICE [4.3 regression]: USE in contained subroutine
@ 2007-06-22 17:32 anlauf at gmx dot de
  2007-06-22 17:33 ` [Bug fortran/32464] " anlauf at gmx dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: anlauf at gmx dot de @ 2007-06-22 17:32 UTC (permalink / raw)
  To: gcc-bugs

Hi,

the attached code started to ICE with gfortran 4.3.0 shortly
after 20070416:

% gfortran -c gfcbug64.f90
gfcbug64.f90:12: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Cheers,
-ha


-- 
           Summary: ICE [4.3 regression]: USE in contained subroutine
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/32464] ICE [4.3 regression]: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
@ 2007-06-22 17:33 ` anlauf at gmx dot de
  2007-06-22 18:15 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gmx dot de @ 2007-06-22 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2007-06-22 17:33 -------
Created an attachment (id=13763)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13763&action=view)
Demo code


-- 


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


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

* [Bug fortran/32464] ICE [4.3 regression]: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
  2007-06-22 17:33 ` [Bug fortran/32464] " anlauf at gmx dot de
@ 2007-06-22 18:15 ` jvdelisle at gcc dot gnu dot org
  2007-06-22 18:17 ` [Bug fortran/32464] [4.3 regression] ICE: " burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-22 18:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-06-22 18:15 -------
Herald,

Both cases work for me on latest trunk.  x86-64  I tried several compiler
switches as well, no problems.


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
  2007-06-22 17:33 ` [Bug fortran/32464] " anlauf at gmx dot de
  2007-06-22 18:15 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-22 18:17 ` burnus at gcc dot gnu dot org
  2007-06-22 18:26 ` dfranke at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-06-22 18:17 -------
I can only partially reproduce this: I don't get a crash, but valgrind shows:

==12017== Conditional jump or move depends on uninitialised value(s)
==12017==    at 0x45229B: gfc_resolve_expr (resolve.c:3272)
==12017==    by 0x40BC7C: resolve_array_bound (array.c:218)
==12017==    by 0x40BD2C: gfc_resolve_array_spec (array.c:252)
==12017==    by 0x456B6C: resolve_symbol (resolve.c:6438)

where resolve.c:3272:
   gcc_assert (expr && sym == expr->symtree->n.sym);

There are no valgrind errors with 4.2.0.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|i686-pc-linux-gnu           |
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.3.0
      Known to work|                            |4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-22 18:17:45
               date|                            |
            Summary|ICE [4.3 regression]: USE in|[4.3 regression] ICE: USE in
                   |contained subroutine        |contained subroutine
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2007-06-22 18:17 ` [Bug fortran/32464] [4.3 regression] ICE: " burnus at gcc dot gnu dot org
@ 2007-06-22 18:26 ` dfranke at gcc dot gnu dot org
  2007-06-22 18:34 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 18:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2007-06-22 18:26 -------
Reduced testcase and backtrace:

module gfcbug64_mod1
contains
  function copy (d)
    real, intent(in) :: d(:)
    real             :: copy(size (d))
    copy = d
  end function copy
end module gfcbug64_mod1

module gfcbug64_mod2
contains
  subroutine foo (x_o)
    real, intent(in) :: x_o(5)
    integer          :: s(size (x_o))
  contains
    subroutine bar ()
      use gfcbug64_mod1, only: copy
    end subroutine bar
  end subroutine foo
end module gfcbug64_mod2

Program received signal SIGSEGV, Segmentation fault.
0x08095f00 in gfc_resolve_expr (e=0x88d1920)
    at ../../../gcc/gcc/fortran/resolve.c:3265
3265              gcc_assert (expr && sym == expr->symtree->n.sym);

(gdb) bt
#0  0x08095f00 in gfc_resolve_expr (e=0x88d1920)
    at ../../../gcc/gcc/fortran/resolve.c:3265
#1  0x08051f8b in resolve_array_bound (e=0x88d1920, check_constant=0)
    at ../../../gcc/gcc/fortran/array.c:218
#2  0x0805202b in gfc_resolve_array_spec (as=0x88d1858, check_constant=0)
    at ../../../gcc/gcc/fortran/array.c:252
#3  0x0809acac in resolve_symbol (sym=0x88d0c08)
    at ../../../gcc/gcc/fortran/resolve.c:6444
#4  0x080a5327 in traverse_ns (st=0x88d0c90, func=0x809ab40 <resolve_symbol>)
    at ../../../gcc/gcc/fortran/symbol.c:2731
#5  0x080983fa in resolve_types (ns=0x88d0800)
    at ../../../gcc/gcc/fortran/resolve.c:7403
#6  0x080984c7 in resolve_types (ns=0x88d0218)
    at ../../../gcc/gcc/fortran/resolve.c:7414
#7  0x080984c7 in resolve_types (ns=0x888d1b0)
    at ../../../gcc/gcc/fortran/resolve.c:7414
#8  0x0809ab1c in gfc_resolve (ns=0x888d1b0)
    at ../../../gcc/gcc/fortran/resolve.c:7477
#9  0x0808e6ec in gfc_parse_file () at ../../../gcc/gcc/fortran/parse.c:3256
#10 0x080b005d in gfc_be_parse_file (set_yydebug=0)
    at ../../../gcc/gcc/fortran/f95-lang.c:301
#11 0x08312f28 in toplev_main (argc=2, argv=0xbff77ce4)
    at ../../../gcc/gcc/toplev.c:1051

Due to the backtrace, I'd think this is related to PR30746. 
Adding Paul Thomas as CC.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org, pault at gcc dot gnu
                   |                            |dot org


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2007-06-22 18:26 ` dfranke at gcc dot gnu dot org
@ 2007-06-22 18:34 ` burnus at gcc dot gnu dot org
  2007-06-22 18:38 ` dfranke at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 18:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-06-22 18:34 -------
Regression testing shows that it was introduced between
2007-05-11-r124613 and 2007-05-12-r124634.

There were two Fortran patches checked in during that period:

http://gcc.gnu.org/viewcvs?view=rev&revision=124613
r124613 | pault | 2007-05-11 08:19:57 +0200 (Fri, 11 May 2007) | 12 lines
2007-05-11  Paul Thomas  <pault@gcc.gnu.org>
        PR fortran/31474 (decl.c)

http://gcc.gnu.org/viewcvs?view=rev&revision=124615
r124615 | pault | 2007-05-11 13:42:56 +0200 (Fri, 11 May 2007) | 19 lines
2007-05-11 Paul Thomas <pault@gcc.gnu.org>
        PR fortran/30878 (resolve.c, symbol.c, trans-io.c)

http://gcc.gnu.org/viewcvs?view=rev&revision=124633
r124633 | pault | 2007-05-12 08:19:43 +0200 (Sat, 12 May 2007) | 15 lines
2007-05-12  Paul Thomas  <pault@gcc.gnu.org>
        PR fortran/30746 (resolve.c, match.h, gfortran.h)


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2007-06-22 18:34 ` burnus at gcc dot gnu dot org
@ 2007-06-22 18:38 ` dfranke at gcc dot gnu dot org
  2007-06-22 19:17 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2007-06-22 18:38 -------

> r124633 | pault | 2007-05-12 08:19:43 +0200 (Sat, 12 May 2007) | 15 lines
> 2007-05-12  Paul Thomas  <pault@gcc.gnu.org>
>        PR fortran/30746 (resolve.c, match.h, gfortran.h)

The assert is triggered in check_host_association() which was introduced in
this revision - that's why I added Paul as CC :)


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2007-06-22 18:38 ` dfranke at gcc dot gnu dot org
@ 2007-06-22 19:17 ` burnus at gcc dot gnu dot org
  2007-06-22 20:04 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 19:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-06-22 19:16 -------
One of the problems is that
   gfc_match_rvalue (&expr);
does not set expr to NULL by default or when an error occurs. Therefore
   gcc_assert (expr && sym == expr->symtree->n.sym);
does not fail but crashes randomly. One probably should fix gfc_match_rvalue
rather than using simply expr = NULL in check_host_association.


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2007-06-22 19:17 ` burnus at gcc dot gnu dot org
@ 2007-06-22 20:04 ` burnus at gcc dot gnu dot org
  2007-06-23 10:48 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2007-06-22 20:04 -------
> One probably should fix gfc_match_rvalue rather than using simply expr = NULL
> in check_host_association. 

At least setting result = NULL at the top of gfc_match_rvalue is wrong. (I
don't know whether a single test case passes afterwards.)
I think I stick to   gfc_expr *expr = NULL;  in check_host_association.

The ICE fails for old_sym->name == "size", i.e. for the intrinsic function
SIZE.
While "old_sym != sym", they are both in the (old_)sym->module "(intrinsic)".


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2007-06-22 20:04 ` burnus at gcc dot gnu dot org
@ 2007-06-23 10:48 ` pault at gcc dot gnu dot org
  2007-06-25 18:28 ` pault at gcc dot gnu dot org
  2007-06-25 18:30 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-23 10:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2007-06-23 10:48 -------
This does the job:

Index: /svn/trunk/gcc/fortran/resolve.c
===================================================================
--- /svn/trunk/gcc/fortran/resolve.c    (revision 125970)
+++ /svn/trunk/gcc/fortran/resolve.c    (working copy)
@@ -3229,7 +3229,8 @@ check_host_association (gfc_expr *e)
     return e->expr_type == EXPR_FUNCTION;

   old_sym = e->symtree->n.sym;
-  if (gfc_current_ns->parent
+  if (!old_sym->attr.use_assoc
+       && gfc_current_ns->parent
        && gfc_current_ns->parent->parent
        && old_sym->ns != gfc_current_ns)
     {

and we probably need to exclude intrinsics, I suppose.  I'll think about it.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-22 18:17:45         |2007-06-23 10:48:39
               date|                            |


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (8 preceding siblings ...)
  2007-06-23 10:48 ` pault at gcc dot gnu dot org
@ 2007-06-25 18:28 ` pault at gcc dot gnu dot org
  2007-06-25 18:30 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-25 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2007-06-25 18:28 -------
Subject: Bug 32464

Author: pault
Date: Mon Jun 25 18:27:59 2007
New Revision: 126000

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126000
Log:
2007-06-25  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32464
        * resolve.c (check_host_association): Return if the old symbol
        is use associated.  Introduce retval to reduce the number of
        evaluations of the first-order return value.

        PR fortran/31494
        * match.c (gfc_match_call): If a host associated symbol is not
        a subroutine, build a new symtree/symbol in the current name
        space.


2007-06-25  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32464
        * gfortran.dg/host_assoc_function_2.f90: New test.

        PR fortran/31494
        * gfortran.dg/host_assoc_call_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/host_assoc_call_1.f90
    trunk/gcc/testsuite/gfortran.dg/host_assoc_function_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32464] [4.3 regression] ICE: USE in contained subroutine
  2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
                   ` (9 preceding siblings ...)
  2007-06-25 18:28 ` pault at gcc dot gnu dot org
@ 2007-06-25 18:30 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-25 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pault at gcc dot gnu dot org  2007-06-25 18:30 -------
Fixed on trunk.

Thanks for the report, Harald.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-06-25 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-22 17:32 [Bug fortran/32464] New: ICE [4.3 regression]: USE in contained subroutine anlauf at gmx dot de
2007-06-22 17:33 ` [Bug fortran/32464] " anlauf at gmx dot de
2007-06-22 18:15 ` jvdelisle at gcc dot gnu dot org
2007-06-22 18:17 ` [Bug fortran/32464] [4.3 regression] ICE: " burnus at gcc dot gnu dot org
2007-06-22 18:26 ` dfranke at gcc dot gnu dot org
2007-06-22 18:34 ` burnus at gcc dot gnu dot org
2007-06-22 18:38 ` dfranke at gcc dot gnu dot org
2007-06-22 19:17 ` burnus at gcc dot gnu dot org
2007-06-22 20:04 ` burnus at gcc dot gnu dot org
2007-06-23 10:48 ` pault at gcc dot gnu dot org
2007-06-25 18:28 ` pault at gcc dot gnu dot org
2007-06-25 18:30 ` pault 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).