re PR fortran/53818 (-finit-local-zero -fno-automatic: Function result cannot have initializer)

2013-02-15  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53818
        * resolve.c (apply_default_init_local): Don't create an
        initializer for a result variable.

2013-02-15  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53818
        * gfortran.dg/init_flag_11.f90: New.

From-SVN: r196073
This commit is contained in:
Tobias Burnus 2013-02-15 09:50:37 +01:00 committed by Tobias Burnus
parent 576fe41adc
commit fab99ea2d2
4 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2013-02-15 Tobias Burnus <burnus@net-b.de>
PR fortran/53818
* resolve.c (apply_default_init_local): Don't create an
initializer for a result variable.
2013-02-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/56224

View File

@ -11031,9 +11031,10 @@ apply_default_init_local (gfc_symbol *sym)
/* For saved variables, we don't want to add an initializer at function
entry, so we just add a static initializer. Note that automatic variables
are stack allocated even with -fno-automatic. */
are stack allocated even with -fno-automatic; we have also to exclude
result variable, which are also nonstatic. */
if (sym->attr.save || sym->ns->save_all
|| (gfc_option.flag_max_stack_var_size == 0
|| (gfc_option.flag_max_stack_var_size == 0 && !sym->attr.result
&& (!sym->attr.dimension || !is_non_constant_shape_array (sym))))
{
/* Don't clobber an existing initializer! */

View File

@ -1,3 +1,8 @@
2013-02-15 Tobias Burnus <burnus@net-b.de>
PR fortran/53818
* gfortran.dg/init_flag_11.f90: New.
2013-02-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/debug/dwarf2/pr53948.c: Allow for more whitespace.

View File

@ -0,0 +1,11 @@
! { dg-do compile }
! { dg-flags "-finit-local-zero -fno-automatic"
!
! PR fortran/53818
!
! Contributed by John Moyard
!
logical function testing(date1, date2) result(test)
integer date1, date2
test = ( (date1 < date2) .or. ( date1==date2 ))
end function testing