diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 437da6fe3d34978e7a3a72f7ec39dc76a54d6408..b6c5fdf42ee359a0c0b0fab8de4d374ff39cd35b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -12709,6 +12709,13 @@ ldm_stm_operation_p (rtx op, bool load, machine_mode mode, addr_reg_in_reglist = true; } + /* The ascending register number requirement only makes sense when dealing + with hard registers. The code above already validated the ascending + requirement so we only need to validate the "hardness" of the last + register in the list. */ + if (regno >= FIRST_PSEUDO_REGISTER) + return false; + if (load) { if (update && addr_reg_in_reglist) diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71436.c b/gcc/testsuite/gcc.c-torture/compile/pr71436.c new file mode 100644 index 0000000000000000000000000000000000000000..ab08d5d369c769fc9e411238fcf1379705e576f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr71436.c @@ -0,0 +1,35 @@ +/* PR target/71436. */ + +#pragma pack(1) +struct S0 +{ + volatile int f0; + short f2; +}; + +void foo (struct S0 *); +int a, d; +static struct S0 b[5]; +static struct S0 c; +void fn1 (); +void +main () +{ + { + struct S0 e; + for (; d; fn1 ()) + { + { + a = 3; + for (; a >= 0; a -= 1) + { + { + e = c; + } + b[a] = e; + } + } + } + } + foo (b); +}