https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95543
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #2 from kargl at gcc dot gnu.org ---
This cures the ICE, which then I believe leads to wrong-code.
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 280157)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -708,7 +708,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
are SAVE_NONE but have an initializer. Otherwise explicitly
initialized variables are SAVE_IMPLICIT and explicitly saved are
SAVE_EXPLICIT. */
- if (!sym->attr.use_assoc
+ if (!sym->attr.use_assoc && !sym->attr.pdt_kind && !sym->attr.pdt_len
&& (sym->attr.save != SAVE_NONE || sym->attr.data
|| (sym->value && sym->ns->proc_name->attr.is_main_program)
|| (flag_coarray == GFC_FCOARRAY_LIB
@@ -1554,7 +1554,9 @@ gfc_get_symbol_decl (gfc_symbol * sym)
fun_or_res = byref && (sym->attr.result
|| (sym->attr.function && sym->ts.deferred));
- if ((sym->attr.dummy && ! sym->attr.function) || fun_or_res)
+ if (((sym->attr.dummy && !sym->attr.function)
+ && !(sym->attr.pdt_kind || sym->attr.pdt_len))
+ || fun_or_res)
{
/* Return via extra parameter. */
if (sym->attr.result && byref