aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/c-common.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr101512.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index aacdfb4..21da679 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -6894,10 +6894,13 @@ complete_flexible_array_elts (tree init)
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);
+ while (handled_component_p (t) || TREE_CODE (t) == C_MAYBE_CONST_EXPR)
+ {
+ if (TREE_CODE (t) == C_MAYBE_CONST_EXPR)
+ t = C_MAYBE_CONST_EXPR_EXPR (t);
+ else
+ t = TREE_OPERAND (t, 0);
+ }
if (!VAR_P (t)
&& TREE_CODE (t) != PARM_DECL
&& TREE_CODE (t) != COMPOUND_LITERAL_EXPR)
diff --git a/gcc/testsuite/gcc.dg/torture/pr101512.c b/gcc/testsuite/gcc.dg/torture/pr101512.c
new file mode 100644
index 0000000..a25da2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101512.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+int n();
+typedef unsigned long V __attribute__ ((vector_size (64)));
+V
+foo (int i, V v)
+{
+ i = ((V)(V){n()})[n()];
+ return v + i;
+}