[Bug fortran/78641] [5/6/7 Regression] [OOP] ICE on polymorphic allocatable function in array constructor
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 2 09:51:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78641
--- Comment #4 from janus at gcc dot gnu.org ---
This patch seems to fix comment 3:
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 243035)
+++ gcc/fortran/class.c (working copy)
@@ -208,6 +208,19 @@ gfc_add_component_ref (gfc_expr *e, const char *na
gfc_component *c;
gfc_ref **tail = &(e->ref);
gfc_ref *ref, *next = NULL;
+
+ if (e->expr_type == EXPR_ARRAY)
+ {
+ /* Handle array constructors. */
+ for (gfc_constructor *cons = gfc_constructor_first
(e->value.constructor);
+ cons; cons = gfc_constructor_next (cons))
+ {
+ if (cons->expr->ts.type == BT_CLASS)
+ gfc_add_component_ref (cons->expr, name);
+ }
+ return;
+ }
+
gfc_symbol *derived = e->symtree->n.sym->ts.u.derived;
while (*tail != NULL)
{
but comment 0 still fails with a different ICE:
internal compiler error: in fold_convert_loc, at fold-const.c:2361
0xb57cb1 fold_convert_loc(unsigned int, tree_node*, tree_node*)
/home/jweil/gcc/gcc7/trunk/gcc/fold-const.c:2361
0x887d13 gfc_trans_array_ctor_element
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:1447
0x88853e gfc_trans_array_constructor_value
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:1631
0x88a538 trans_array_constructor
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:2365
0x88af3a gfc_add_loop_ss_code
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:2639
0x892042 gfc_conv_loop_setup(gfc_loopinfo*, locus*)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:4890
0x8e63f2 gfc_trans_assignment_1
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-expr.c:9781
0x8e7448 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool, bool, bool)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-expr.c:10124
0x8e74c0 gfc_trans_assign(gfc_code*)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-expr.c:10136
0x882b1d trans_code
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans.c:1790
0x8830fe gfc_trans_code(gfc_code*)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans.c:2097
0x8c127a gfc_generate_function_code(gfc_namespace*)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-decl.c:6271
0x883142 gfc_generate_code(gfc_namespace*)
/home/jweil/gcc/gcc7/trunk/gcc/fortran/trans.c:2114
0x811d07 translate_all_program_units
/home/jweil/gcc/gcc7/trunk/gcc/fortran/parse.c:6038
0x81237c gfc_parse_file()
/home/jweil/gcc/gcc7/trunk/gcc/fortran/parse.c:6238
0x86b55d gfc_be_parse_file
/home/jweil/gcc/gcc7/trunk/gcc/fortran/f95-lang.c:202
More information about the Gcc-bugs
mailing list