+2004-09-22 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/16566
+ * c-typeck.c (build_component_ref): Don't special-case
+ COMPOUND_EXPR.
+
2004-09-22 Frank Ch. Eigler <fche@redhat.com>
* dominance.c (verify_dominators): Don't SEGV if recount_dominator
if (!objc_is_public (datum, component))
return error_mark_node;
- /* If DATUM is a COMPOUND_EXPR, move our reference inside it.
- Ensure that the arguments are not lvalues; otherwise,
- if the component is an array, it would wrongly decay to a pointer in
- C89 mode.
- We cannot do this with a COND_EXPR, because in a conditional expression
- the default promotions are applied to both sides, and this would yield
- the wrong type of the result; for example, if the components have
- type "char". */
- switch (TREE_CODE (datum))
- {
- case COMPOUND_EXPR:
- {
- tree value = build_component_ref (TREE_OPERAND (datum, 1), component);
- return build2 (COMPOUND_EXPR, TREE_TYPE (value),
- TREE_OPERAND (datum, 0), non_lvalue (value));
- }
- default:
- break;
- }
-
/* See if there is a field or component with name COMPONENT. */
if (code == RECORD_TYPE || code == UNION_TYPE)
+2004-09-22 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/16566
+ * gcc.c-torture/compile/pr16566-1.c,
+ gcc.c-torture/compile/pr16566-2.c,
+ gcc.c-torture/compile/pr16566-3.c: New tests.
+
2004-09-22 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/17512
--- /dev/null
+/* ICE with flexible arrays in non-lvalue structures. Bug 16566
+ (comment #3). */
+
+struct S;
+
+struct C {
+ int i;
+ struct S *tab[];
+};
+
+struct S { struct C c; };
+
+void foo (struct S *x) {
+ foo(((void)1, x->c).tab[0]);
+}
--- /dev/null
+/* ICE with flexible arrays in non-lvalue structures. Bug 16566
+ (testcase from duplicate bug 16575). */
+
+struct S;
+struct C {
+ int i;
+ struct S *tab[];
+};
+struct S { struct C c; };
+void foo (struct S *x) {
+ ((void)1, x->c).tab[0] = 0;
+}