Bug 40045 - ICE with type extension and -fdump-parse-tree
Summary: ICE with type extension and -fdump-parse-tree
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Daniel Kraft
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2009-05-06 13:46 UTC by janus
Modified: 2009-05-14 20:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-05-06 15:01:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-05-06 13:46:23 UTC
Segfault with -fdump-parse-tree:

type t
end type
type, extends(t) :: t2
end type t2
end
Comment 1 Dominique d'Humieres 2009-05-06 14:31:30 UTC
Confirmed and this is regression with repect to 4.4.0:

[karma] f90/bug% gfc -fdump-parse-tree pr40045.f90

        Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
        procedure name = MAIN__
        symtree: MAIN__  Ambig 0
        symbol MAIN__ (UNKNOWN 0)(PROGRAM UNKNOWN-INTENT PUBLIC UNKNOWN-PROC UNKNOWN SUBROUTINE)

        symtree: t  Ambig 0
        symbol t (UNKNOWN 0)(DERIVED UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC UNKNOWN)
        Procedure bindings:

f951: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
          PROCEDURE, [karma] f90/bug% 
[karma] f90/bug% gfc44 -fdump-parse-tree pr40045.f90

        Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
        procedure name = MAIN__
        symtree: MAIN__  Ambig 0
        symbol MAIN__ (UNKNOWN 0)(PROGRAM UNKNOWN-INTENT PUBLIC UNKNOWN-PROC UNKNOWN SUBROUTINE)

        symtree: t  Ambig 0
        symbol t (UNKNOWN 0)(DERIVED UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC UNKNOWN)
        Procedure bindings:


        symtree: t2  Ambig 0
        symbol t2 (UNKNOWN 0)(DERIVED UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC UNKNOWN)
        components: (t (DERIVED t) ())
        Procedure bindings:

Comment 2 Tobias Burnus 2009-05-06 14:39:20 UTC
Regarding the segfault, valgrind shows:

==14376== Invalid read of size 1
==14376==    by 0x616A4F7: fprintf (in /lib64/libc-2.9.so)
==14376==    by 0x4B4BF1: show_typebound (dump-parse-tree.c:693)

The line is:
            fprintf (dumpfile, "PASS(%s)", st->n.tb->pass_arg);
and the interesting question is: Why is it called? There are no type-bound procedures (and also no components [except of t2%t]. Thus why is
  if (!st->n.tb)
    return;
not working?

 * * *

Related problem: The following gives: show_code_node(): Bad statement code

type t
  procedure(), nopass, pointer :: p
end type t
type(t) m
!external bar
!m%p => bar
call m%p()
end
Comment 3 janus 2009-05-06 14:58:53 UTC
(In reply to comment #2)
> and the interesting question is: Why is it called? There are no type-bound
> procedures (and also no components [except of t2%t]. 

If it's a regression it may be caused by Daniel's r146733 ("reworking type-bound procedures")?!?



> Related problem: The following gives: show_code_node(): Bad statement code

I will handle this in my PPC patch before committing.
Comment 4 Daniel Kraft 2009-05-06 15:01:04 UTC
Yes, that sounds like a problem caused by my patch; it did change the structure of storing the type-bounds, so maybe simply changing the if to the one shown by Tobias was wrong.

I will look into this!
Comment 5 Daniel Kraft 2009-05-14 20:03:03 UTC
Subject: Bug 40045

Author: domob
Date: Thu May 14 20:02:46 2009
New Revision: 147540

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147540
Log:
2009-05-14  Daniel Kraft  <d@domob.eu>

	PR fortran/40045
	* dump-parse-tree.c (show_typebound): Fix missing adaption to new
	type-bound procedure storage structure.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dump-parse-tree.c

Comment 6 Daniel Kraft 2009-05-14 20:05:15 UTC
Fixed (not addressing the "related" part in comment #2, but Janus promised to work on it).