diff --git a/gcc/recog.c b/gcc/recog.c index 8c098cf5b0f..2720aaaac85 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -2547,10 +2547,7 @@ constrain_operands (int strict, alternative_mask alternatives) return 1; for (c = 0; c < recog_data.n_operands; c++) - { - constraints[c] = recog_data.constraints[c]; - matching_operands[c] = -1; - } + constraints[c] = recog_data.constraints[c]; do { @@ -2570,6 +2567,9 @@ constrain_operands (int strict, alternative_mask alternatives) continue; } + for (opno = 0; opno < recog_data.n_operands; opno++) + matching_operands[opno] = -1; + for (opno = 0; opno < recog_data.n_operands; opno++) { rtx op = recog_data.operand[opno]; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97144.c b/gcc/testsuite/gcc.c-torture/compile/pr97144.c new file mode 100644 index 00000000000..380e5d4e887 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr97144.c @@ -0,0 +1,24 @@ +int a, b = 5, c = 3; +char d; +char e[1]; +int f[] = {0, 0, 1}; +short g; +char *h = e; +void i(void) { b = a; } +static void j(void) { + h = e; + if (f[2]) + k: + for (;;) { + for (c = 0; c <= 4; c++) { + for (g = 0; g <= 4; g++) + f[g + 4] &= 2; + } + if (d) + goto k; + } +} +void l(void) { + j(); + c = 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr97144.c b/gcc/testsuite/gcc.target/aarch64/sve/pr97144.c new file mode 100644 index 00000000000..75245e2350b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr97144.c @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -ftree-vectorize" } */ + +int a, b = 5, c = 3; +char d; +char e[1]; +int f[] = {0, 0, 1}; +short g; +char *h = e; +void i(void) { b = a; } +static void j(void) { + h = e; + if (f[2]) + k: + for (;;) { + for (c = 0; c <= 4; c++) { + for (g = 0; g <= 4; g++) + f[g + 4] &= 2; + } + if (d) + goto k; + } +} +void l(void) { + j(); + c = 0; +}