middle-end: Skip initialization of opaque type variables [PR103127]

For -ftrivial-auto-var-init=*, skip initializing the variable if it is an
opaque type, because CONST0_RTX(mode) is not defined for opaque modes.

2021-12-01  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR middle-end/103127
	* gimplify.c (is_var_need_auto_init): Handle opaque types.

gcc/testsuite/
	PR middle-end/103127
	* gcc.target/powerpc/pr103127.c: New test.
This commit is contained in:
Peter Bergner 2021-12-01 13:17:52 -06:00
parent 185b307b03
commit 5b1ef8b9db
2 changed files with 20 additions and 0 deletions

View File

@ -1829,6 +1829,7 @@ is_var_need_auto_init (tree decl)
|| !DECL_HARD_REGISTER (decl))
&& (flag_auto_var_init > AUTO_INIT_UNINITIALIZED)
&& (!lookup_attribute ("uninitialized", DECL_ATTRIBUTES (decl)))
&& !OPAQUE_TYPE_P (TREE_TYPE (decl))
&& !is_empty_type (TREE_TYPE (decl)))
return true;
return false;

View File

@ -0,0 +1,19 @@
/* PR target/103127 */
/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -ftrivial-auto-var-init=zero" } */
/* Verify we do not ICE on the following tests. */
void
foo (__vector_quad *dst)
{
__vector_quad acc;
*dst = acc;
}
void
bar (__vector_pair *dst)
{
__vector_pair pair;
*dst = pair;
}