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