diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-02-15 09:50:37 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2013-02-15 09:50:37 +0100 |
commit | fab99ea2d290e785b8554a384bb4334fcc7b7591 (patch) | |
tree | 44c52186888dc70bbeadc20f1ac352ed992b3ffc /gcc/fortran/resolve.c | |
parent | 576fe41adc751a29ba41b01cce29baec4bb481b3 (diff) | |
download | gcc-fab99ea2d290e785b8554a384bb4334fcc7b7591.zip gcc-fab99ea2d290e785b8554a384bb4334fcc7b7591.tar.gz gcc-fab99ea2d290e785b8554a384bb4334fcc7b7591.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b5faaca..a29fef9 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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! */ |