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: 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
Attachment:
0001-PR-Fortran-71523.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |