On 8/31/26 7:18 AM, Jin Ma wrote:
A full-width bit-field store can use force_subreg to reinterpret a DImode
function address as V2SImode.  validate_subreg accepts the resulting
SUBREG of a SYMBOL_REF, although it is not a general_operand, causing an
ICE during vregs.

Reject symbolic SUBREGs when either mode has multiple units.  This makes
force_subreg materialize the address in a register first, while preserving
scalar and single-unit vector forms.

        PR target/127060

gcc/ChangeLog:

        * emit-rtl.cc (validate_subreg): Reject symbolic constants when either
        mode has multiple units.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/rvv/base/pr127060.c: New test.
Hmm.    Close :-)

SUBREGs can only have 2 valid operands.  They must be either a REG or a MEM.  So I would suggest rejecting any CONST, LABEL_REF or SYMBOL_REF, irrespective of the number of units in the modes.

Since this changes emit-rtl, which is target independent, it must be bootstrapped and regression tested on a major platform such as x86 or aarch64.  Please make sure to do that testing.  Assuming you simplify the patch by always rejecting those forms and the regression test passes, then the updated patch is OK for the trunk.

jeff


Reply via email to