[multiple changes]

2019-01-19  Dominique d'Humieres  <dominiq@gcc.gnu.org>

	PR fortran/37835
	* resolve.c (resolve_types): Add !flag_automatic.
	* symbol.c (gfc_add_save): Silence warnings.

2019-01-18  Dominique d'Humieres  <dominiq@gcc.gnu.org>

	PR fortran/37835
	* gfortran.dg/no-automatic.f90: New test.

From-SVN: r268098
This commit is contained in:
Dominique d'Humieres 2019-01-19 22:45:43 +01:00
parent 5131b898e5
commit b4e17cadd5
6 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2019-01-19 Dominique d'Humieres <dominiq@gcc.gnu.org>
PR fortran/37835
* resolve.c (resolve_types): Add !flag_automatic.
* symbol.c (gfc_add_save): Silence warnings.
2019-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77960

View File

@ -1377,6 +1377,9 @@ The default, which is @option{-fautomatic}, uses the stack for local
variables smaller than the value given by @option{-fmax-stack-var-size}.
Use the option @option{-frecursive} to use no static memory.
Local variables or arrays having an explicit @code{SAVE} attribute are
silently ignored unless the @option{-pedantic} option is added.
@item -ff2c
@opindex ff2c
@cindex calling convention

View File

@ -16673,7 +16673,7 @@ resolve_types (gfc_namespace *ns)
gfc_traverse_ns (ns, resolve_values);
if (ns->save_all)
if (ns->save_all || !flag_automatic)
gfc_save_all (ns);
iter_stack = NULL;

View File

@ -1306,7 +1306,8 @@ gfc_add_save (symbol_attribute *attr, save_state s, const char *name,
if (s == SAVE_EXPLICIT)
gfc_unset_implicit_pure (NULL);
if (s == SAVE_EXPLICIT && attr->save == SAVE_EXPLICIT)
if (s == SAVE_EXPLICIT && attr->save == SAVE_EXPLICIT
&& (flag_automatic || pedantic))
{
if (!gfc_notify_std (GFC_STD_LEGACY,
"Duplicate SAVE attribute specified at %L",

View File

@ -1,3 +1,8 @@
2019-01-18 Dominique d'Humieres <dominiq@gcc.gnu.org>
PR fortran/37835
* gfortran.dg/no-automatic.f90: New test.
2019-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77960

View File

@ -0,0 +1,20 @@
! { dg-do run }
! { dg-options "-fno-automatic" }
!
! PR fortran/37835
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>.
!
subroutine foo(n)
integer :: n
type t
integer :: i = 42
end type t
type(t) :: myt
if(n==1) myt%i = 2
print *, myt%i
if (n > 1 .and. myt%i /= 2) stop 1
end subroutine foo
call foo(1)
call foo(2)
end