This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/84710] [8 Regression] ICE: RTL check: expected code 'reg', have 'subreg' in rhs_regno, at rtl.h:1896 with -O -fno-forward-propagate
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Mar 2018 07:51:18 +0000
- Subject: [Bug target/84710] [8 Regression] ICE: RTL check: expected code 'reg', have 'subreg' in rhs_regno, at rtl.h:1896 with -O -fno-forward-propagate
- Auto-submitted: auto-generated
- References: <bug-84710-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84710
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-03-06
CC| |jakub at gcc dot gnu.org,
| |segher at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is on try_combine with
i3:
(insn 21 20 22 2 (set (reg:SI 109)
(const_int 0 [0])) "pr84710.c":8 679 {*aarch64_lshr_sisd_or_int_si3}
(expr_list:REG_DEAD (reg:SI 108)
(nil)))
i2:
(insn 20 19 21 2 (set (reg:SI 108)
(zero_extend:SI (subreg:HI (reg:SI 106) 0))) "pr84710.c":8 89
{*zero_extendhisi2_aarch64}
(nil))
i1:
(insn 19 18 20 2 (set (subreg:HI (reg:SI 106) 0)
(const_int 0 [0])) "pr84710.c":8 45 {*movhi_aarch64}
(nil))
and on:
4286 /* It can only be a SET of a REG or of a paradoxical SUBREG of a
REG. */
4287 x = SET_DEST (x);
4288 if (paradoxical_subreg_p (x))
4289 x = SUBREG_REG (x);
4290
4291 unsigned int regno = REGNO (x);
x is:
(subreg:HI (reg:SI 106) 0)
rtl.texi documents the behavior of SUBREGs as lvalues not just for paradoxical
SUBREGs, but also for normal SUBREGs.
So, we have a proof that the paradoxical_subreg_p guard is insufficient.
I'd go with:
--- gcc/combine.c.jj 2018-03-05 23:13:26.478215559 +0100
+++ gcc/combine.c 2018-03-06 08:50:17.756288841 +0100
@@ -4283,9 +4283,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2,
if (GET_CODE (x) == PARALLEL)
x = XVECEXP (newi2pat, 0, 0);
- /* It can only be a SET of a REG or of a paradoxical SUBREG of a REG.
*/
+ /* It can only be a SET of a REG or of a SUBREG of a REG. */
x = SET_DEST (x);
- if (paradoxical_subreg_p (x))
+ if (SUBREG_P (x))
x = SUBREG_REG (x);
unsigned int regno = REGNO (x);
(until proven otherwise).