diff options
author | Peter Bergner <bergner@linux.ibm.com> | 2021-02-15 10:38:33 -0600 |
---|---|---|
committer | Peter Bergner <bergner@linux.ibm.com> | 2021-02-15 10:39:24 -0600 |
commit | a33927c9ab4af3f4595251ce0c8ba54db821b039 (patch) | |
tree | 5f79735742d5e3d77c1993dbbce39b08027367e5 /gcc | |
parent | cc9a0a3d79d6abb08753a819c9ea21a25015e962 (diff) | |
download | gcc-a33927c9ab4af3f4595251ce0c8ba54db821b039.zip gcc-a33927c9ab4af3f4595251ce0c8ba54db821b039.tar.gz gcc-a33927c9ab4af3f4595251ce0c8ba54db821b039.tar.bz2 |
rtl-optimization: Fix uninitialized use of opaque mode variable ICE [PR98872]
The initialize_uninitialized_regs function emits (set (reg:) (CONST0_RTX))
for all uninitialized pseudo uses. However, some modes (eg, opaque modes)
may not have a CONST0_RTX defined, leading to an ICE when we try and create
the initialization insn. The fix is to skip emitting the initialization
if there is no CONST0_RTX defined for the mode.
2021-02-15 Peter Bergner <bergner@linux.ibm.com>
gcc/
PR rtl-optimization/98872
* init-regs.c (initialize_uninitialized_regs): Skip initialization
if CONST0_RTX is NULL.
gcc/testsuite/
PR rtl-optimization/98872
* gcc.target/powerpc/pr98872.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/init-regs.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/pr98872.c | 19 |
2 files changed, 23 insertions, 1 deletions
diff --git a/gcc/init-regs.c b/gcc/init-regs.c index 903c654..72e898f 100644 --- a/gcc/init-regs.c +++ b/gcc/init-regs.c @@ -105,7 +105,10 @@ initialize_uninitialized_regs (void) start_sequence (); emit_clobber (reg); - emit_move_insn (reg, CONST0_RTX (GET_MODE (reg))); + /* PR98872: Only emit an initialization if MODE has a + CONST0_RTX defined. */ + if (CONST0_RTX (GET_MODE (reg))) + emit_move_insn (reg, CONST0_RTX (GET_MODE (reg))); move_insn = get_insns (); end_sequence (); emit_insn_before (move_insn, insn); diff --git a/gcc/testsuite/gcc.target/powerpc/pr98872.c b/gcc/testsuite/gcc.target/powerpc/pr98872.c new file mode 100644 index 0000000..f33ad9b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr98872.c @@ -0,0 +1,19 @@ +/* PR target/98872 */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* 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; +} |