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

Peter Bergner bergner@linux.ibm.com
Mon Nov 29 21:56:58 GMT 2021

Sorry for dropping the ball on testing the patch from the bugzilla!

The following patch fixes the ICE reported in the bugzilla on the pre-existing
gcc testsuite test case, bootstraps and shows no testsuite regressions
on powerpc64le-linux.  Ok for trunk?


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

	PR middle-end/103127
	* internal-fn.c (expand_DEFERRED_INIT): Skip if VAR_TYPE is opaque.

diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 0cba95411a6..7cc0e9d5293 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -3070,6 +3070,10 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
+      /* Skip variables of opaque types that are in a register.  */
+      if (OPAQUE_TYPE_P (var_type))
+	return;
       /* If this variable is in a register use expand_assignment.
 	 For boolean scalars force zero-init.  */
       tree init;

More information about the Gcc-patches mailing list