This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ping! Re: [PATCH, Fortran] PR71523 - Static variables given automatic initializers with -finit-* and -fmax-stack-var-size


On 07/15/2016 01:32 PM, Fritz Reese wrote:
https://gcc.gnu.org/ml/fortran/2016-06/msg00032.html

I have plenty more DEC extension patches ready to submit but I've been
waiting on this one to get integrated to avoid bit rot. I'd like to
get my DEC patches through before stage 1 closes up for gcc 7 (in
about a month, right?). Can someone review/commit this (and the other
DEC extensions when they come up) please?

Thanks,

---
Fritz Reese



This patch approved. I will commit this one and help with the others.

Jerry





On Mon, Jun 13, 2016 at 12:46 PM, Fritz Reese <fritzoreese@gmail.com> wrote:
RE: https://gcc.gnu.org/ml/fortran/2016-06/msg00023.html

On Thu, Jun 9, 2016 at 2:01 PM, Fritz Reese <fritzoreese@gmail.com> wrote:
It looks like when -fautomatic and -finit-local-zero are set with
-fmax-stack-var-size=X, an automatic initializer is generated even for
variables larger than X which are given static storage, causing such
static variables to have their value re-initialized upon each entry to
their namespace.
...
<snip>

After doing more research I noticed PR41860
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41860) was very similar
to this issue, so I've decided this is a bug and created PR71523
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71523). Here's a patch
for it.

The bug seems to be due to an oversight - since the size of a variable
is not known at resolution time when initializer expressions are
applied, -finit-* is too greedy in the case that the variable is large
enough to be removed from the stack according to -fmax-stack-var-size.
This patch removes automatic initializers at translation time which
were inserted by -finit-* (and inserts the appropriate static
initializer) according to -fmax-stack-var-size.

The patch passes all regression tests (on x86_64-redhat-linux),
including the two additional tests of its own demonstrating the issue.

---
Fritz Reese


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]