ICE on valid with allocatable class component
Tobias Burnus
burnus@net-b.de
Mon Aug 29 09:03:00 GMT 2011
On 08/29/2011 07:37 AM, Andrew Benson wrote:
> The attached code causes an ICE with gfortran 4.7 r178129 - I haven't found
> anything which is obviously this problem reported in bugzilla. Note that if I
> combine the code in the two files into a single file (as in the attached
> combined.F90), and compile that it works without any problem.
That's a regression: I do not get a segfault with GCC 4.6.1 20110801
(Rev. 177033).
Valgrind shows:
==9734== Invalid read of size 1
==9734== at 0x6076E8: gfc_sym_type(gfc_symbol*) (trans-types.c:2112)
==9734== by 0x606BA4: gfc_get_function_type(gfc_symbol*)
(trans-types.c:2674)
==9734== by 0x60796A: gfc_get_ppc_type(gfc_component*)
(trans-types.c:2233)
==9734== by 0x6065CF: gfc_get_derived_type(gfc_symbol*)
(trans-types.c:2386)
==9734== by 0x606A78: gfc_typenode_for_spec(gfc_typespec*)
(trans-types.c:1056)
==9734== by 0x607648: gfc_sym_type(gfc_symbol*) (trans-types.c:2052)
==9734== by 0x5C2F26: gfc_get_symbol_decl(gfc_symbol*)
(trans-decl.c:1327)
==9734== by 0x5FF4E3: gfc_trans_allocate(gfc_code*) (trans-stmt.c:5020)
The failure occurs for:
if (sym->attr.optional || sym->ns->proc_name->attr.entry_master)
type = build_pointer_type (type);
Hereby:
(gdb) p sym->name
$1 = 0x2aaaaab42fc0 "src"
which is of type
$8 = 0x2aaaaac33e10 "componentbasicstandard"
the problem is:
(gdb) p sym->ns->proc_name
$5 = (gfc_symbol *) 0x0
If one looks at the original dump of the combined file, one sees "src"
only for __copy_g_nodes_Componentbasicstandard and for
__copy_g_nodes_Gobject; for the former:
__copy_g_nodes_Componentbasicstandard (struct componentbasicstandard &
restrict src, struct comp
onentbasicstandard & restrict dst)
{
*dst = *src;
}
For the file containing only the PROGRAM, the line trans-types.c:2112 is
actually reached three times - every time for sym->name "src". Twice
sym->ns->proc_name->name is "__copy_g_nodes_Gobject" - and at the third
time one gets the ICE for proc_name == NULL and ts.u.derived->name ==
"componentbasicstandard".
Tobias
More information about the Fortran
mailing list