Commit b7280579 by Richard Biener Committed by Richard Biener

re PR middle-end/83415 (ICE during gimplification of assignment to read-only vector)

2017-12-14  Richard Biener  <rguenther@suse.de>

	PR c/83415
	c/
	* c-fold.c (c_fully_fold_internal): Treat VIEW_CONVERT_EXPR
	like REALPART_EXPR for the behavior of whether its operand
	is an lvalue.

	* gcc.dg/pr83415.c: New testcase.

From-SVN: r255629
parent e729c8e0
2017-12-14 Richard Biener <rguenther@suse.de>
PR c/83415
* c-fold.c (c_fully_fold_internal): Treat VIEW_CONVERT_EXPR
like REALPART_EXPR for the behavior of whether its operand
is an lvalue.
2017-12-12 Marek Polacek <polacek@redhat.com> 2017-12-12 Marek Polacek <polacek@redhat.com>
PR c/82679 PR c/82679
......
...@@ -434,6 +434,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, ...@@ -434,6 +434,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
goto unary; goto unary;
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_EXPR: case IMAGPART_EXPR:
case VIEW_CONVERT_EXPR:
op0_lval = lval; op0_lval = lval;
/* FALLTHRU */ /* FALLTHRU */
case INDIRECT_REF: case INDIRECT_REF:
...@@ -441,7 +442,6 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, ...@@ -441,7 +442,6 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
case FLOAT_EXPR: case FLOAT_EXPR:
CASE_CONVERT: CASE_CONVERT:
case ADDR_SPACE_CONVERT_EXPR: case ADDR_SPACE_CONVERT_EXPR:
case VIEW_CONVERT_EXPR:
case NON_LVALUE_EXPR: case NON_LVALUE_EXPR:
case NEGATE_EXPR: case NEGATE_EXPR:
case BIT_NOT_EXPR: case BIT_NOT_EXPR:
......
2017-12-14 Richard Biener <rguenther@suse.de> 2017-12-14 Richard Biener <rguenther@suse.de>
PR c/83415
* gcc.dg/pr83415.c: New testcase.
2017-12-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/83418 PR tree-optimization/83418
* gcc.dg/torture/pr83418.c: New testcase. * gcc.dg/torture/pr83418.c: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-O" } */
const short __attribute__((vector_size(16))) y = { 0, 1, 2, 3, 4, 5, 6, 7 };
int
main (int argc, short *argv[])
{
int i = argc;
y[i] = 7 - i; /* { dg-warning "read-only" } */
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