This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR fortran/42517: -fcheck=recursion does not work with -fopenmp
Hi Steve,
welcome in the world of magic numbers for flag_max_stack_var_size ...
- Positive numbers: Threshold of variable size - below static, above stack
- Zero: -fno-automatic (-save, -static in other compilers) - all
variables are static
- Minus 1: -frecursive - all local variables are on the stack
- Minus 2: Initial value
-fmax-stack-var-size=... is the only option which sets the size directly
(only positive numbers); the other values are set in the post
processing. First comes some checking for error/warnings, e.g. when
combining only static (-fno-automatic) with never static (-frecursive),
but then the value is changed:
* -frecursive sets it to -1
* -fopenmp sets it to -1, but only if untouched (i.e. still initial
value of -2)
* If it is still untouched, the default value of 32768 is used
* -fno-automatic unconditionally sets it to 0.
On 01/05/2010 03:50 PM, Steve Kargl wrote:
> On Tue, Jan 05, 2010 at 03:19:26PM +0100, Tobias Burnus wrote:
>
>> + /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
>>
> This comment looks wrong
>
>> + if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp
>> + && gfc_option.flag_automatic)
>>
> given the -2 here.
>
No, it should work fine: "-2" means untouched. Thus, if there is no
-fmax-stack-var-size=<...>, it is modified. If it is -1 (due to
-frecursion), the if branch is a no op.
>> + {
>> + gfc_option.flag_recursive = 1;
>> + gfc_option.flag_max_stack_var_size = -1;
>> + }
>> +
>>
I hope, everything is clear now.
Tobias