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

anlauf at gcc dot gnu.org changed:

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

--- Comment #7 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #2)
> Looks very related to the len_trim issue in pr84868.  Possibly a duplicate.

After the fix for pr84868, the issue still persists.
Reduced testcase:

module m
  implicit none
  private
contains
  subroutine s()
!   character, parameter :: c(3) = ['*', '+', '-']   ! works when placed here
  contains
    function f(n) result(z)
      integer,  intent(in) :: n
      character, parameter :: c(3) = ['*', '+', '-'] ! ICE when here
      character(len_trim(c(n)))  :: z
      z = c(n)
    end
  end
end

We hit the assert in gfc_create_module_variable:

  gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE
              || (sym->ns->parent->proc_name->attr.flavor == FL_MODULE
                  && sym->fn_result_spec));

(gdb) p sym->ns->proc_name->attr.flavor
$1 = FL_PROCEDURE
(gdb) p sym->ns->parent->proc_name->attr.flavor
$2 = FL_PROCEDURE

For the working version from above, one finds:

(gdb) p sym->ns->proc_name->attr.flavor
$3 = FL_PROCEDURE
(gdb) p sym->ns->parent->proc_name->attr.flavor
$4 = FL_MODULE

Reply via email to