This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/80752] [5/6/7/8 Regression] ICE with wrong type initialization
- From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 May 2017 18:31:45 +0000
- Subject: [Bug fortran/80752] [5/6/7/8 Regression] ICE with wrong type initialization
- Auto-submitted: auto-generated
- References: <bug-80752-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80752
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, May 15, 2017 at 05:57:38PM +0000, kargl at gcc dot gnu.org wrote:
>
> --- Comment #2 from kargl at gcc dot gnu.org ---
> Here's two possible patches.
>
Here's a 3rd possible patch, and it appears to do what is
needed.
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 248066)
+++ gcc/fortran/expr.c (working copy)
@@ -4395,7 +4395,12 @@ gfc_generate_initializer (gfc_typespec *
if ((comp->ts.type != tmp->ts.type
|| comp->ts.kind != tmp->ts.kind)
&& !comp->attr.pointer && !comp->attr.proc_pointer)
- gfc_convert_type_warn (ctor->expr, &comp->ts, 2, false);
+ {
+ bool val;
+ val = gfc_convert_type_warn (ctor->expr, &comp->ts, 1, false);
+ if (val == false)
+ return NULL;
+ }
}
if (comp->attr.allocatable