On 01/11/2012 06:03 PM, Tobias Burnus wrote:
-finit-* creates an initialization for local variables - either as
static initializer or by "initializing" at run time.
The latter also works with automatic variables, but was breaking with
-fno-automatic, which causes all nonautomatic local variables to be
placed in static memory. However, combining -finit-* -fno-automatic with
automatic arrays is failing at resolution time. The fix turned out to be
rather simple.
Good, I wondered how this would work (the reason I thought it would
always work with automatic arrays was that it apparently (assembler
source and output of trial program) worked for arrays smaller than the
limit to place them on the stack.
Unfortunately, I forgot to test this against the combination of -finit-*
-fno-automatic, which just proves you cannot have too many test cases.
I wondered about characters strings where the length is a nonconstant
specification question (thus: they are also automatic data objects). It
turned out that only the "initialization" was missing - no code
generation (trans*.c) change and no other resolution change were required.
The first part fixes a regression as "-finit-* -fno-automatic" could be
combined before (albeit without initializing the automatic arrays - but
there was no compile error).
Perhaps we can issue a warning.
Build and regtested on x86-64-linux.
OK for the trunk?
Note that I backported this change (noted in PR/51310) to the 4.6
branch, so it's needed there too.
Thanks for fixing this !
--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news