https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124161

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to anlauf from comment #4)
> (In reply to Josef Melcr from comment #3)
> > Created attachment 63726 [details]
> > cvised testcase
> > 
> > Doesn't produce the false positive warning
> 
> This example ICEs for me also with 14.3.1, so I doubt that the blamed commit
> is reponsible.
> 
> The submodule seems essential for the ICE to occur.

Josef was spot on. Reverting the part of your patch in resolve.cc fixed the
problem. Fortunately the fix is so obvious that I will push it after
regtesting:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index e0cdd06cfde..14a66516b38 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -18914,7 +18914,7 @@ skip_interfaces:
              && sym->ns->proc_name->attr.if_source != IFSRC_IFBODY))
        apply_default_init (sym);
       else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc
-              && sym->result)
+              && !a->used_in_submodule && sym->result)
        /* Default initialization for function results.  */
        apply_default_init (sym->result);
       else if (a->function && sym->result && a->access != ACCESS_PRIVATE

Regards

Paul

Reply via email to