https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70937
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 6 May 2016, dominiq at lps dot ens.fr wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70937 > > --- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > With the second patch in comment 9 applied on top of my working tree (heavily > patched), I get > > [Book15] f90/bug% gfc > /opt/gcc/_clean/gcc/testsuite/gfortran.dg/allocatable_function_4.f90 > -fdump-tree-original > /opt/gcc/_clean/gcc/testsuite/gfortran.dg/allocatable_function_4.f90:52:0: > > end function unique_A > > internal compiler error: tree check: expected tree that contains 'decl common' > structure, have 'identifier_node' in print_declaration, at > tree-pretty-print.c:3287 Which means TYPE_NAME is an IDENTIFIER_NODE here. Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 235945) +++ gcc/fortran/trans-decl.c (working copy) @@ -3818,6 +3818,12 @@ gfc_trans_vla_type_sizes (gfc_symbol *sy } gfc_trans_vla_type_sizes_1 (type, body); + /* gfc_build_qualified_array may have built this type but left TYPE_NAME + pointing to the original type whose type sizes we need to expose to + the gimplifier unsharing. */ + if (TYPE_NAME (type) + && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) + gfc_add_expr_to_block (body, build1 (DECL_EXPR, type, TYPE_NAME (type))); } fixes this. I'm going to re-test with that change, will not be able to commit before Monday.