This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50410] [4.6/4.7 Regression] ICE in record_reference
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Oct 2011 17:36:33 +0000
- Subject: [Bug fortran/50410] [4.6/4.7 Regression] ICE in record_reference
- Auto-submitted: auto-generated
- References: <bug-50410-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50410
--- Comment #7 from kargl at gcc dot gnu.org 2011-10-17 17:36:33 UTC ---
(In reply to comment #2)
> The following produces a Segmentation fault in gfc_conv_structure (r178925)
>
> type t
> integer g
> end type
> type(t) :: u=t(1)
> data u%g /2/
> end
The following patch removes the seqfault. If one adds
'print *, u%g' before end and compiles the resulting
program, then one gets 1. This is acceptable, IMHO,
because the code is invalid.
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 180099)
+++ trans-expr.c (working copy)
@@ -4747,7 +4747,7 @@ gfc_conv_structure (gfc_se * se, gfc_exp
cm = expr->ts.u.derived->components;
for (c = gfc_constructor_first (expr->value.constructor);
- c; c = gfc_constructor_next (c), cm = cm->next)
+ c && cm; c = gfc_constructor_next (c), cm = cm->next)
{
/* Skip absent members in default initializers and allocatable
components. Although the latter have a default initializer