+2018-08-03 Bogdan Harjoc <harjoc@gmail.com>
+
+ PR c/86690
+ * c-typeck.c (lookup_field): Do not use TYPE_LANG_SPECIFIC after
+ errors.
+
2018-08-01 Martin Sebor <msebor@redhat.com>
PR tree-optimization/86650
/* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers
to the field elements. Use a binary search on this array to quickly
find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC
- will always be set for structures which have many elements. */
+ will always be set for structures which have many elements.
- if (TYPE_LANG_SPECIFIC (type) && TYPE_LANG_SPECIFIC (type)->s)
+ Duplicate field checking replaces duplicates with NULL_TREE so
+ TYPE_LANG_SPECIFIC arrays are potentially no longer sorted. In that
+ case just iterate using DECL_CHAIN. */
+
+ if (TYPE_LANG_SPECIFIC (type) && TYPE_LANG_SPECIFIC (type)->s
+ && !seen_error ())
{
int bot, top, half;
tree *field_array = &TYPE_LANG_SPECIFIC (type)->s->elts[0];
+2018-08-03 Bogdan Harjoc <harjoc@gmail.com>
+
+ PR c/86690
+ * gcc.dg/union-duplicate-field.c: New test.
+
2018-08-03 Jason Merrill <jason@redhat.com>
PR c++/86706
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+int a0;
+
+struct S
+{
+ int a1;
+ union {
+ int a0;
+ int a1; /* { dg-error "duplicate member" } */
+ int a2, a3, a4, a5, a6, a7, a8, a9;
+ int a10, a11, a12, a13, a14, a15;
+ };
+};
+
+int f()
+{
+ struct S s;
+ return s.a0;
+}