This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR77450


The following fixes PR77450.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2016-09-06  Richard Biener  <rguenther@suse.de>

	PR c/77450
	c-family/
	* c-common.c (c_common_mark_addressable_vec): Handle
	COMPOUND_LITERAL_EXPR.

	* c-c++-common/vector-subscript-7.c: Adjust.
	* c-c++-common/vector-subscript-8.c: New testcase.

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 240004)
+++ gcc/c-family/c-common.c	(working copy)
@@ -10918,7 +10918,9 @@ c_common_mark_addressable_vec (tree t)
 {   
   while (handled_component_p (t))
     t = TREE_OPERAND (t, 0);
-  if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
+  if (!VAR_P (t)
+      && TREE_CODE (t) != PARM_DECL
+      && TREE_CODE (t) != COMPOUND_LITERAL_EXPR)
     return;
   TREE_ADDRESSABLE (t) = 1;
 }
Index: gcc/testsuite/c-c++-common/vector-subscript-7.c
===================================================================
--- gcc/testsuite/c-c++-common/vector-subscript-7.c	(revision 240004)
+++ gcc/testsuite/c-c++-common/vector-subscript-7.c	(working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-ccp1" } */
+/* { dg-options "-O -fdump-tree-fre1" } */
 
 typedef int v4si __attribute__ ((vector_size (16)));
 
@@ -11,4 +11,4 @@ main (int argc, char** argv)
   return ((v4si){1, 2, 42, 0})[j];
 }
 
-/* { dg-final { scan-tree-dump "return 42;" "ccp1" } } */
+/* { dg-final { scan-tree-dump "return 42;" "fre1" } } */
Index: gcc/testsuite/c-c++-common/vector-subscript-8.c
===================================================================
--- gcc/testsuite/c-c++-common/vector-subscript-8.c	(revision 0)
+++ gcc/testsuite/c-c++-common/vector-subscript-8.c	(working copy)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+typedef int V __attribute__((vector_size(4)));
+
+void
+foo(void)
+{
+  (V){ 0 }[0] = 0;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]