diff mbox

[C] Fix PR79756

Message ID alpine.LSU.2.20.1703021051250.30051@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener March 2, 2017, 9:52 a.m. UTC
Another case of missed TREE_ADDRESSABLE on vector indexing.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for trunk?

2017-03-02  Richard Biener  <rguenther@suse.de>

	PR c/79756
	* c-common.c (c_common_mark_addressable_vec): Look through
	C_MAYBE_CONST_EXPR.

	* gcc.dg/vector-1.c: New testcase.

Comments

Marek Polacek March 2, 2017, 10:11 a.m. UTC | #1
On Thu, Mar 02, 2017 at 10:52:08AM +0100, Richard Biener wrote:
> 
> Another case of missed TREE_ADDRESSABLE on vector indexing.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Ok for trunk?

Ok (given what Joseph wrote in the PR and that c_fully_fold_internal
handles VIEW_CONVERT_EXPR).

	Marek
diff mbox

Patch

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 245833)
+++ gcc/c-family/c-common.c	(working copy)
@@ -6534,6 +6534,8 @@  complete_array_type (tree *ptype, tree i
 void 
 c_common_mark_addressable_vec (tree t)
 {   
+  if (TREE_CODE (t) == C_MAYBE_CONST_EXPR)
+    t = C_MAYBE_CONST_EXPR_EXPR (t);
   while (handled_component_p (t))
     t = TREE_OPERAND (t, 0);
   if (!VAR_P (t)
Index: gcc/testsuite/gcc.dg/vector-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vector-1.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/vector-1.c	(working copy)
@@ -0,0 +1,8 @@ 
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90" } */
+
+typedef int V __attribute__ ((vector_size(4)));
+void fn1 ()
+{
+  (V){(1,0)}[0] = 0;
+}