https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
--- Comment #6 from anlauf at gcc dot gnu.org ---
I tried the following patch, which however regresses on a couple testcases:
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index d9d101775f6..cfc6fc055bd 100644
--- a/gcc/fortran/re
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
--- Comment #5 from anlauf at gcc dot gnu.org ---
There is a check in expr.cc:2623 that is reached if one changes the
testcase to a subroutine, but not if it is a program:
4615 if (!attr.save && rvalue->expr_type == EXPR_VARIABLE
4616
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #3)
> (In reply to Richard Biener from comment #2)
> >
> > But maybe 'z' shouldn't be of static storage duration ...
>
> No, I think it shouldn't. A shoul
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
Mikael Morin changed:
What|Removed |Added
CC||mikael at gcc dot gnu.org
--- Comment #3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
--- Comment #2 from Richard Biener ---
There's a static variable ('z') with an initializer that refers to an automatic
variable ('a').
The appropriate way to runtime initialize is not with DECL_INITIAL but
instead with an INIT_EXPR or MODIFY_EX
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107075
anlauf at gcc dot gnu.org changed:
What|Removed |Added
Last reconfirmed||2022-09-28
Ever confirme