https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102366

--- Comment #13 from anlauf at gcc dot gnu.org ---
In decl.c:match_attr_spec we have:

5818      /* Since Fortran 2008 module variables implicitly have the SAVE
attribute.  */
5819      if ((gfc_current_state () == COMP_MODULE
5820           || gfc_current_state () == COMP_SUBMODULE)
5821          && !current_attr.save
5822          && (gfc_option.allow_std & GFC_STD_F2008) != 0)
5823        current_attr.save = SAVE_IMPLICIT;

I tried to extend that to the case of COMP_PROGRAM, but:

(gdb) p gfc_state_stack->state 
$162 = COMP_NONE

But when I add

program test

at the beginning of the file, I find

(gdb) p gfc_state_stack->state 
$164 = COMP_PROGRAM

So this may be too early to handle arrays in the main.

Given Jakub's comment, I'll fix that and regtest.

Reply via email to