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

Fritz Reese fritzoreese@gmail.com
Fri Jul 15 20:32:00 GMT 2016


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


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



More information about the Fortran mailing list