[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2019-05-06 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

--- Comment #5 from Martin Sebor  ---
(In reply to Alexandre Ganea from comment #4)

The test case has been reduced a little too far -- it reads an uninitialized
variable:

  for (unsigned i;; i++)
for (; i;)
  if (j[i] == j[0])
h.e();

But the false positive can also be reproduced by initializing the variable to
zero.  Can you please open a new bug with the corrected test case?

[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2019-05-06 Thread alexandre.ganea at ubisoft dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

Alexandre Ganea  changed:

   What|Removed |Added

 CC||alexandre.ganea at ubisoft dot 
com

--- Comment #4 from Alexandre Ganea  ---
Hi,

We get what seems like a spurious warning at the following location in LLVM:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp#L1718

The warning is:
//warning: array subscript is above array bounds [-Warray-bounds]
//if (NewBldVec[i] == NewBldVec[j]) {
//~~~^

This only occurs when compiling with GCC 7.1+ and 9.1/trunk (not with 8), with
-O3 -Warray-bounds

This has been creduce'd to:

class a {
  int b;
  unsigned c;

public:
  bool operator==(a) { return b && c; }
};
class d {
public:
  void e();
};
class f {
  a g(d &) const;
};
a f::g(d ) const {
  a j[1];
  for (unsigned i;; i++)
for (; i;)
  if (j[i] == j[0])
h.e();
}

Could you please confirm the issue?
Thank you!

[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2017-11-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

--- Comment #2 from Martin Sebor  ---
Author: msebor
Date: Thu Nov 16 16:48:36 2017
New Revision: 254833

URL: https://gcc.gnu.org/viewcvs?rev=254833=gcc=rev
Log:
PR middle-end/63477 - Bogus warning with -O3 -Warray-bounds: array subscript
is above array bounds

gcc/testsuite/ChangeLog:

PR middle-end/63477
* gcc.dg/pr63477.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/pr63477.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2017-11-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Known to work||8.0
 Resolution|--- |FIXED
  Known to fail|8.0 |

--- Comment #3 from Martin Sebor  ---
Strangely, I cannot reproduce this warning anymore with GCC 8.  Bisection
points to r220157 (gcc 5.0.0) as the revision that fixed it.  I've added the
test case to the test suite in r254833 and with that I'm resolving this bug as
fixed.  Please reopen it if the problem reappears.

[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2017-11-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

[Bug middle-end/63477] [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds

2017-10-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-10-17
 CC||hubicka at gcc dot gnu.org,
   ||msebor at gcc dot gnu.org
  Known to work||4.7.4
Summary|Bogus warning with -O3  |[6/7/8 Regression] Bogus
   |-Warray-bounds: array   |warning with -O3
   |subscript is above array|-Warray-bounds: array
   |bounds  |subscript is above array
   ||bounds
 Ever confirmed|0   |1
  Known to fail||4.8.3, 4.9.3, 5.3.0, 6.2.0,
   ||7.1.0, 8.0

--- Comment #1 from Martin Sebor  ---
Confirmed.  The first revision to trigger the error is r192990 (gcc 4.8.0) so
marking this a regression.