http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2012-06-30 CC| |burnus at gcc dot gnu.org Summary|-fno-automatic cannot have |-finit-local-zero |initializer |-fno-automatic: Function | |result cannot have | |initializer Ever Confirmed|0 |1 --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-30 14:31:29 UTC --- (In reply to comment #0) > But when I integrate '-fno-automatic' option, I obtain this error message : > function testing(date1, date2) result(test) > 1 > Error: Function result 'test' at (1) cannot have an initializer I helps if you tell up all options. The issue seemingly only occurs with -fno-automatic *and* -finit-local-zero (or -finit-logical=true|false). Two things surprise me: a) Why are there two initializer, when looking at the dump (-fdump-tree-original). (Requires that one does not have -fno-automatic) - the should be only one, shouldn't it? b) Why does this only trigger with -fno-automatic? The code currently has the following. At a glance, it should always trigger and the apply_default_init_local should be after the checks (together with the simplify): resolve_fl_variable (gfc_symbol *sym, int mp_flag) ... if (sym->value == NULL && sym->attr.referenced) apply_default_init_local (sym); /* Try to apply a default initialization. */ ... /* Reject illegal initializers. */ if (!sym->mark && sym->value) ... else if (sym->attr.result) gfc_error ("Function result '%s' at %L cannot have an initializer", sym->name, &sym->declared_at);