[Bug middle-end/101671] pr83510 fails with -Os because threader confuses -Warray-bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101671 --- Comment #3 from CVS Commits --- The master branch has been updated by Martin Sebor : https://gcc.gnu.org/g:0b3560d3a9f2b55ba4807f2b0f8cbbf6cee9e6e3 commit r12-2634-g0b3560d3a9f2b55ba4807f2b0f8cbbf6cee9e6e3 Author: Martin Sebor Date: Fri Jul 30 11:41:02 2021 -0600 Move failed part of a test to a new file [PR101671] Related: PR middle-end/101671 - pr83510 fails with -Os because threader confuses -Warray-bounds gcc/testsuite: PR middle-end/101671 * gcc.c-torture/compile/pr83510.c: Move test functions... * gcc.dg/Warray-bounds-87.c: ...to this file.
[Bug middle-end/101671] pr83510 fails with -Os because threader confuses -Warray-bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101671 --- Comment #2 from Aldy Hernandez --- Yeah, that would be great. Thanks! On Thu, Jul 29, 2021 at 6:05 PM msebor at gcc dot gnu.org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101671 > > Martin Sebor changed: > >What|Removed |Added > > CC||msebor at gcc dot gnu.org >Last reconfirmed||2021-07-29 >Keywords||diagnostic > Summary|pr83510 fails because |pr83510 fails with -Os >|threader confuses |because threader confuses >|-Warray-bounds |-Warray-bounds > Ever confirmed|0 |1 > Status|UNCONFIRMED |NEW > > --- Comment #1 from Martin Sebor --- > Confirmed. I've extracted the test case that fails from the bigger test. > Rather than xfailing the whole test I think it would be better to split out > just the failing case and/or xfail just that assertion. Unless you expect the > others to start failing too due to some changes you still have planned? > > $ cat a.c && gcc -Os -S -Wall a.c > extern int f (void); > extern void sink (unsigned int); > > unsigned int a[10]; > > static unsigned int g (int i, int j) > { > if (i == 9) > return j; > else if (i == 10) > return a[i];// no warning here > return 0; > } > > void test_g (int j) > { > for (int i = 0; i < 10; i++) > { > if (f ()) > sink (g (i, j)); > } > } > > static unsigned int h (int i, int j) > { > switch (i) > { > case 9: > return j; > case 10: > return a[i]; // { dg-bogus "-Warray-bounds" } > } > return 0; > } > > void test_h (int j) > { > for (int i = 0; i < 10; i++) > { > if (f ()) > sink (h (i, j)); > } > } > In function ‘h’, > inlined from ‘test_h’ at a.c:41:2: > a.c:31:15: warning: array subscript 10 is above array bounds of ‘unsigned > int[10]’ [-Warray-bounds] >31 | return a[i]; // { dg-bogus "-Warray-bounds" } > | ~^~~ > a.c: In function ‘test_h’: > a.c:4:14: note: while referencing ‘a’ > 4 | unsigned int a[10]; > | ^ > > -- > You are receiving this mail because: > You reported the bug. >
[Bug middle-end/101671] pr83510 fails with -Os because threader confuses -Warray-bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101671 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org Last reconfirmed||2021-07-29 Keywords||diagnostic Summary|pr83510 fails because |pr83510 fails with -Os |threader confuses |because threader confuses |-Warray-bounds |-Warray-bounds Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Martin Sebor --- Confirmed. I've extracted the test case that fails from the bigger test. Rather than xfailing the whole test I think it would be better to split out just the failing case and/or xfail just that assertion. Unless you expect the others to start failing too due to some changes you still have planned? $ cat a.c && gcc -Os -S -Wall a.c extern int f (void); extern void sink (unsigned int); unsigned int a[10]; static unsigned int g (int i, int j) { if (i == 9) return j; else if (i == 10) return a[i];// no warning here return 0; } void test_g (int j) { for (int i = 0; i < 10; i++) { if (f ()) sink (g (i, j)); } } static unsigned int h (int i, int j) { switch (i) { case 9: return j; case 10: return a[i]; // { dg-bogus "-Warray-bounds" } } return 0; } void test_h (int j) { for (int i = 0; i < 10; i++) { if (f ()) sink (h (i, j)); } } In function ‘h’, inlined from ‘test_h’ at a.c:41:2: a.c:31:15: warning: array subscript 10 is above array bounds of ‘unsigned int[10]’ [-Warray-bounds] 31 | return a[i]; // { dg-bogus "-Warray-bounds" } | ~^~~ a.c: In function ‘test_h’: a.c:4:14: note: while referencing ‘a’ 4 | unsigned int a[10]; | ^