[Bug fortran/99326] [9/10/11 Regression] ICE in gfc_build_dummy_array_decl, at fortran/trans-decl.c:1299

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 2 11:39:02 GMT 2021


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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
This looks very much like an error I looked at before.
I think that was for 'select rank (y => x)', which
has the same issue as 'select type (y => x)' or
as this PR shows 'associate (y=>x)'.


Additionally, the following points to the 'x' (gfc_current_location)
and not to 'y'; we should save that location for the error message:

11 |       associate (y => x)
   |                       1
Error: Assumed shape array at (1) must be a dummy argument

That's something we should fix in match.c, where we have:
      if (gfc_match (" %n =>", newAssoc->name) != MATCH_YES)
...
      if (gfc_match (" %e", &newAssoc->target) 
...
      newAssoc->where = gfc_current_locus;

for associate but likewise for select type/rank.

 * * * 

In resolve.c, there is:
      if (((as->type == AS_ASSUMED_SIZE && !as->cp_was_assumed)
           || as->type == AS_ASSUMED_SHAPE)
          && !sym->attr.dummy && !sym->attr.select_type_temporary)

the latter is set for both select type + select rank. Looks as if we also need
a check like:
   sym->assoc
or something like that.

We probably should audit all code which uses select_type_temporary or
sym->assoc to see whether we need to add a condition for associate or select
type/rank there as well.


More information about the Gcc-bugs mailing list