Message ID | 20160628183332.GE7387@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Tue, 28 Jun 2016, Jakub Jelinek wrote: > Hi! > > The following testcase ICEs because C_TYPE_INCOMPLETE_VARS is cleared even > on the main type, while it should be cleared only on the variant types. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk/6.2? OK.
--- gcc/c/c-typeck.c.jj 2016-06-21 08:51:40.000000000 +0200 +++ gcc/c/c-typeck.c 2016-06-28 17:53:19.282187787 +0200 @@ -13669,7 +13669,8 @@ c_build_qualified_type (tree type, int t : build_qualified_type (type, type_quals)); /* A variant type does not inherit the list of incomplete vars from the type main variant. */ - if (RECORD_OR_UNION_TYPE_P (var_type)) + if (RECORD_OR_UNION_TYPE_P (var_type) + && TYPE_MAIN_VARIANT (var_type) != var_type) C_TYPE_INCOMPLETE_VARS (var_type) = 0; return var_type; } --- gcc/testsuite/gcc.dg/pr71685.c.jj 2016-06-28 17:43:07.885806691 +0200 +++ gcc/testsuite/gcc.dg/pr71685.c 2016-06-28 17:42:50.000000000 +0200 @@ -0,0 +1,6 @@ +/* PR c/71685 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu11" } */ + +extern struct S v, s; +struct S { int t; int p[]; } v = { 4, 0 };