Commit d17680f3 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/77767 (Side-effect from VLA array parameters lost)

	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
parent a388bdc7
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> 2016-12-20 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_compound_statement): Improve * gimple-parser.c (c_parser_gimple_compound_statement): Improve
......
...@@ -5580,11 +5580,21 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -5580,11 +5580,21 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (type) == ERROR_MARK) if (TREE_CODE (type) == ERROR_MARK)
return error_mark_node; return error_mark_node;
if (expr == NULL) if (expr == NULL)
expr = &expr_dummy; {
expr = &expr_dummy;
expr_dummy = NULL_TREE;
}
if (expr_const_operands == NULL) if (expr_const_operands == NULL)
expr_const_operands = &expr_const_operands_dummy; 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; *expr_const_operands = declspecs->expr_const_operands;
if (decl_context == FUNCDEF) 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> 2016-12-20 Pat Haugen <pthaugen@us.ibm.com>
* gcc.dg/sms-3.c: Add -fno-sched-pressure for powerpc. * gcc.dg/sms-3.c: Add -fno-sched-pressure for powerpc.
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment