c/104002 - shufflevector variable indexing

Variable indexing of a __builtin_shufflevector result is broken because
we fail to properly mark the TARGET_EXPR decl as addressable.

2022-01-13  Richard Biener  <rguenther@suse.de>

	PR c/104002
gcc/c-family/
	* c-common.c (c_common_mark_addressable_vec): Handle TARGET_EXPR.

gcc/testsuite/
	* c-c++-common/builtin-shufflevector-3.c: Move ...
	* c-c++-common/torture/builtin-shufflevector-3.c: ... here.
This commit is contained in:
Richard Biener 2022-01-13 11:55:14 +01:00
parent 53ead57879
commit f45a2232bc
2 changed files with 4 additions and 1 deletions

View file

@ -6989,12 +6989,15 @@ c_common_mark_addressable_vec (tree t)
}
if (!VAR_P (t)
&& TREE_CODE (t) != PARM_DECL
&& TREE_CODE (t) != COMPOUND_LITERAL_EXPR)
&& TREE_CODE (t) != COMPOUND_LITERAL_EXPR
&& TREE_CODE (t) != TARGET_EXPR)
return;
if (!VAR_P (t) || !DECL_HARD_REGISTER (t))
TREE_ADDRESSABLE (t) = 1;
if (TREE_CODE (t) == COMPOUND_LITERAL_EXPR)
TREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (t)) = 1;
else if (TREE_CODE (t) == TARGET_EXPR)
TREE_ADDRESSABLE (TARGET_EXPR_SLOT (t)) = 1;
}