https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78392
--- Comment #2 from janus at gcc dot gnu.org --- (In reply to janus from comment #0) > On trunk, the error looks like this: > > internal compiler error: in gfc_trans_auto_array_allocation, at > fortran/trans-array.c:5979 This line is an assert, and simply removing it makes the code in comment 0 compile and run without errors: Index: gcc/fortran/trans-array.c =================================================================== --- gcc/fortran/trans-array.c (Revision 242535) +++ gcc/fortran/trans-array.c (Arbeitskopie) @@ -5976,7 +5976,6 @@ gfc_trans_auto_array_allocation (tree decl, gfc_sy type = TREE_TYPE (type); gcc_assert (!sym->attr.use_assoc); - gcc_assert (!TREE_STATIC (decl)); gcc_assert (!sym->module); if (sym->ts.type == BT_CHARACTER It also regtests cleanly on current trunk. With this patch, the only difference in the dump of comment 0 and comment 1 is: --- c0.f90.003t.original 2016-11-17 13:15:57.487735846 +0100 +++ c1.f90.003t.original 2016-11-17 13:13:07.096377920 +0100 @@ -12,7 +12,7 @@ test () void * restrict D.3458; integer(kind=8) ubound.0; integer(kind=8) size.1; - static integer(kind=4)[0:D.3455] * restrict x; + integer(kind=4)[0:D.3455] * restrict x; integer(kind=8) D.3455; bitsizetype D.3456; sizetype D.3457; As an alternative to removing the assert, one could possibly prevent SAVEd variables in the main PROGRAM from being declared as "static" (which might also cure the performance regressions that Dominique reported for my patch for PR 55207)?