diff --git a/gcc/lra-lives.cc b/gcc/lra-lives.cc index f7a3ba8d76a..f60e564da82 100644 --- a/gcc/lra-lives.cc +++ b/gcc/lra-lives.cc @@ -989,7 +989,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p) /* We can have early clobbered non-operand hard reg and the same hard reg as an insn input. Don't make hard reg dead before the insns. */ - for (reg2 = curr_id->regs; reg2 != NULL; reg2 = reg2->next) + for (reg2 = curr_static_id->hard_regs; reg2 != NULL; reg2 = reg2->next) if (reg2->type != OP_OUT && reg2->regno == reg->regno) break; if (reg2 == NULL) diff --git a/gcc/testsuite/gcc.target/avr/lra-cpymem_qi.c b/gcc/testsuite/gcc.target/avr/lra-cpymem_qi.c new file mode 100644 index 00000000000..fdffb445b45 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/lra-cpymem_qi.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=avr51 -Os" } */ + +#include + +struct A +{ + unsigned int a; + unsigned char c1, c2; + bool b1 : 1; +}; + +void +foo (const struct A *x, int y) +{ + int s = 0, i; + for (i = 0; i < y; ++i) + { + const struct A a = x[i]; + s += a.b1 ? 1 : 0; + } + if (s != 0) + __builtin_abort (); +} + +/* { dg-final { scan-assembler-not "movw\[^\n\r]*r26,r30" } } */