[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

2017-11-22 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82588

--- Comment #6 from David Malcolm  ---
Author: dmalcolm
Date: Wed Nov 22 21:12:36 2017
New Revision: 255082

URL: https://gcc.gnu.org/viewcvs?rev=255082=gcc=rev
Log:
jit: update test suite for change to -Warray-bounds

jit.dg/test-error-array-bounds.c is a test of how libgccjit
handles errors coming from the middle-end, using -Warray-bounds as
an example.

It started failing as of r254830 (aka
987b3316c4e7c908e3c7d2151c20971f9707ad66),
due to that commit changing the wording of the message.

This commit fixes the jit testcase by updating it to use the new
wording.

gcc/testsuite/ChangeLog:
PR tree-optimization/82588
PR tree-optimization/82583
* jit.dg/test-error-array-bounds.c (verify_code): Update expected
error message from -Warray-bounds.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/jit.dg/test-error-array-bounds.c

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

Martin Sebor  changed:

   What|Removed |Added

  Known to work||8.0
   Target Milestone|--- |8.0
  Known to fail||5.4.0, 6.4.0, 7.2.0

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=82455
 Resolution|--- |FIXED

--- Comment #5 from Martin Sebor  ---
The -Warrray-bounds part of the issue has been fixed in r254830.  GCC now
issues the warnings below for the test case in comment #0:

a.c: In function ‘f1’:
a.c:17:11: warning: array subscript 4611686018427387904 is above array bounds
of ‘int[]’ [-Warray-bounds]
   return a[__SIZE_MAX__ / sizeof (int) + 1];   // missing -Warray-bounds
  ~^
a.c: In function ‘f2’:
a.c:22:14: warning: array subscript 9223372036854775807 is above array bounds
of ‘char[]’ [-Warray-bounds]
   return a->a[__SIZE_MAX__ / 2];   // missing -Warray-bounds
  ^~

The out-of-bounds offset is still not diagnosed.  It's the subject of a
separate bug (pr82455).

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

--- Comment #4 from Martin Sebor  ---
Author: msebor
Date: Thu Nov 16 16:12:36 2017
New Revision: 254830

URL: https://gcc.gnu.org/viewcvs?rev=254830=gcc=rev
Log:
PR tree-optimization/82588 - missing -Warray-bounds on a excessively large
index
PR tree-optimization/82583 - missing -Warray-bounds on out-of-bounds inner
indic

gcc/ChangeLog:

PR tree-optimization/82588
PR tree-optimization/82583
* tree-vrp.c (check_array_ref): Handle flexible array members,
string literals, and inner indices.
(search_for_addr_array): Add detail to diagnostics.

gcc/testsuite/ChangeLog:

PR tree-optimization/82588
PR tree-optimization/82583
* c-c++-common/Warray-bounds.c: New test.
* gcc.dg/Warray-bounds-11.c: Adjust.
* gcc.dg/Warray-bounds-22.c: New test.


Added:
trunk/gcc/testsuite/c-c++-common/Warray-bounds.c
trunk/gcc/testsuite/gcc.dg/Warray-bounds-22.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/Warray-bounds-11.c
trunk/gcc/tree-vrp.c

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #3 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01122.html

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-10-18
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
Testing a fix.

[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index

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

Martin Sebor  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=68325

--- Comment #1 from Martin Sebor  ---
See also bug 68325 for a similar report of -Warray-bounds failing to detect
negative indices into flexible array members.