Bug 43039 - [lto/-fwhole-file] fortran-dev - ICE in gfc_conv_component_ref dynamic_dispatch_5.f03
Summary: [lto/-fwhole-file] fortran-dev - ICE in gfc_conv_component_ref dynamic_dispat...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-02-11 17:27 UTC by Tobias Burnus
Modified: 2010-03-20 11:29 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-03-20 11:29:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2010-02-11 17:27:28 UTC
$ gfortran -flto gfortran.dg/dynamic_dispatch_5.f03

gfortran.dg/dynamic_dispatch_5.f03: In function 'MAIN__':
gfortran.dg/dynamic_dispatch_5.f03:175:0: internal compiler error: in gfc_conv_component_ref, at fortran/trans-expr.c:466
Comment 1 Tobias Burnus 2010-02-11 17:46:31 UTC
It already occurs for -fwhole-file
Comment 2 Thomas Koenig 2010-02-14 12:38:58 UTC
The problem appears to be a lack of a backend_decl with
-fwhole-file:

Breakpoint 1, fancy_abort (file=0xd474a0 "../../trunk/gcc/fortran/trans-expr.c", line=466,
    function=0xd47e40 "gfc_conv_component_ref") at ../../trunk/gcc/diagnostic.c:727
727     {
(gdb) up
#1  0x0000000000557e63 in gfc_conv_component_ref () at ../../trunk/gcc/fortran/trans-expr.c:466
466       gcc_assert (c->backend_decl);
(gdb) p c->backend_decl
$1 = (tree) 0x0
(gdb) p *c
$2 = {name = 0x7ffff5d0af18 "$vptr", ts = {type = BT_DERIVED, kind = 0, u = {derived = 0x13d11b0,
      cl = 0x13d11b0}, interface = 0x0, is_c_interop = 0, is_iso_c = 0, f90_type = BT_DERIVED}, attr = {
    allocatable = 0, dimension = 0, external = 0, intrinsic = 0, optional = 0, pointer = 1, target = 0,
    value = 0, volatile_ = 0, temporary = 0, dummy = 0, result = 0, assign = 0, threadprivate = 0,
    not_always_present = 0, implied_index = 0, subref_array_pointer = 0, proc_pointer = 0, asynchronous = 0,
    class_pointer = 0, save = SAVE_NONE, data = 0, is_protected = 0, use_assoc = 0, use_only = 0,
    use_rename = 0, imported = 0, in_namelist = 0, in_common = 0, in_equivalence = 0, function = 0,
    subroutine = 0, procedure = 0, generic = 0, generic_copy = 0, implicit_type = 0, untyped = 0,
    is_bind_c = 0, extension = 0, is_class = 0, class_ok = 0, vtab = 0, is_c_interop = 0, is_iso_c = 0,
    sequence = 0, elemental = 0, pure = 0, recursive = 0, unmaskable = 0, masked = 0, contained = 0,
    mod_proc = 0, abstract = 0, noreturn = 0, entry = 0, entry_master = 0, mixed_entry_master = 0,
    always_explicit = 0, referenced = 0, is_main_program = 0, access = ACCESS_UNKNOWN, intent = INTENT_UNKNOWN,
    flavor = FL_UNKNOWN, if_source = IFSRC_UNKNOWN, proc = PROC_UNKNOWN, cray_pointer = 0, cray_pointee = 0,
    alloc_comp = 0, pointer_comp = 0, proc_pointer_comp = 0, private_comp = 0, zero_comp = 0, ext_attr = 0,
    volatile_ns = 0x0, asynchronous_ns = 0x0}, as = 0x0, backend_decl = 0x0, loc = {nextc = 0x0, lb = 0x0},
  initializer = 0x13d06e0, next = 0x0, formal = 0x0, formal_ns = 0x0, tb = 0x0}

Confirmed.
Comment 3 Paul Thomas 2010-03-18 21:24:07 UTC
Subject: Bug 43039

Author: pault
Date: Thu Mar 18 21:23:35 2010
New Revision: 157552

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157552
Log:
2010-03-18  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/43039
        * trans-expr.c (conv_parent_component_references): Ensure that
	'dt' has a backend_decl.

        PR fortran/43043
        * trans-expr.c (gfc_conv_structure): Ensure that the derived
	type has a backend_decl.

        PR fortran/43044
        * resolve.c (resolve_global_procedure): Check that the 'cl'
	structure is not NULL.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-expr.c

Comment 4 Paul Thomas 2010-03-18 21:28:45 UTC
Fixed on trunk.

Thanks for the report.

Paul
Comment 5 Dominique d'Humieres 2010-03-20 11:22:47 UTC
Revision 157552 does not fix the ICE for gfortran.dg/dynamic_dispatch_5.f03 with -fwhole-file on the fortran-dev branch:

/opt/gcc/work/gcc/testsuite/gfortran.dg/dynamic_dispatch_5.f03:32:0: internal compiler error: in gfc_create_module_variable, at fortran/trans-decl.c:3393
Comment 6 Paul Thomas 2010-03-20 11:29:21 UTC
Problem is slightly different on fortran-dev, as Dominique says in comment #5.

Paul