-fno-automatic option (PR 20592)

FX Coudert fxcoudert@gmail.com
Wed Aug 31 21:59:00 GMT 2005


> This option should not apply to RECURSIVE functions. It's ok for non-recursive 
> functions because it's just making undefined behaviour implementation 
> defined. However for RECURSIVE functions it breaks legal programs.

We'll have to think about that. On one hand, this option is mostly used 
for compatibility reasons by people using old code, with no recursive 
functions in it. So, do you think we should silently ignore the option 
for recursive functions, or do we need to error out ("-fno-automatic 
option cannot be used with recursive functions")?

>>+Treat each program unit as if the @code{SAVE} statement was specified for
>>+every local variable and array referenced in it. Does not affect common
>>+blocks. (Some Fortran compilers provide this option under the name
>>+@option{-static}.)
> 
> This isn't entirely accurate. It's the equivalent of adding a single "save" 
> statement with no saved-entity-list. This is different because it only 
> applies to "all allowed items in the same scoping unit" (Section 5.2.4). In 
> particular it does not apply to automatic (aka variable size) objects. eg.

I was merely copy-pasting the g77 info doc. I'll try to come up with 
something better, along the lines you mention.

> subroutine foo(n)
>   integer n
>   integer, dimension(n) :: a
>   save
>   a = 0;
> end subroutine
> 
> "a" will not be given the SAVE attribute.

Yes, indeed. I don't know if your comment was only about the doc or the 
patch itself, but just in case: the -fno-automatic option does add the 
save attribute only to non-automatic variables (in fact, it uses the 
same code as for a single "save" statement with no saved-entity-list.

FX



More information about the Fortran mailing list