PR c/77767
* c-decl.c (grokdeclarator): If *expr is non-NULL, append expression
to *expr instead of overwriting it.
* gcc.c-torture/execute/pr77767.c: New test.
From-SVN: r243832
+2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/77767
+ * c-decl.c (grokdeclarator): If *expr is non-NULL, append expression
+ to *expr instead of overwriting it.
+
2016-12-20 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_compound_statement): Improve
if (TREE_CODE (type) == ERROR_MARK)
return error_mark_node;
if (expr == NULL)
- expr = &expr_dummy;
+ {
+ expr = &expr_dummy;
+ expr_dummy = NULL_TREE;
+ }
if (expr_const_operands == NULL)
expr_const_operands = &expr_const_operands_dummy;
- *expr = declspecs->expr;
+ if (declspecs->expr)
+ {
+ if (*expr)
+ *expr = build2 (COMPOUND_EXPR, TREE_TYPE (declspecs->expr), *expr,
+ declspecs->expr);
+ else
+ *expr = declspecs->expr;
+ }
*expr_const_operands = declspecs->expr_const_operands;
if (decl_context == FUNCDEF)
+2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/77767
+ * gcc.c-torture/execute/pr77767.c: New test.
+
2016-12-20 Pat Haugen <pthaugen@us.ibm.com>
* gcc.dg/sms-3.c: Add -fno-sched-pressure for powerpc.
--- /dev/null
+/* PR c/77767 */
+
+void
+foo (int a, int b[a++], int c, int d[c++])
+{
+ if (a != 2 || c != 2)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ int e[10];
+ foo (1, e, 1, e);
+ return 0;
+}