[Bug fortran/115700] [11/12/13/14 regression] Bogus warning for associate with assumed-length character array

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 2 19:52:17 GMT 2024


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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #5 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-July/060625.html

What the patch does not address is substring references, e.g.

  associate (tmp4 => x(:)(1:))
    if (len (tmp4) /= len (x)) stop 4
  end associate

I looked at resolve_assoc_var, at the block:

  /* Fix up the type-spec for CHARACTER types.  */

creating a new string length and setting sym->ts.deferred = 1;
but could not find suitable restrictions so that no regression occurs.

Maybe gfc_conv_expr_descriptor is another place:

  /* Set the string_length for a character array.  */

but gfc_get_expr_charlen (expr) returns a non_lvalue_expr,
so this fails for me sooner or later.


More information about the Gcc-bugs mailing list