[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-07-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Martin Sebor  ---
Per comment 10, will not be backporting to release branches.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-07-20 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

--- Comment #10 from rguenther at suse dot de  ---
On Thu, 19 Jul 2018, msebor at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047
> 
> Martin Sebor  changed:
> 
>What|Removed |Added
> 
>  Status|NEW |ASSIGNED
>Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
> gnu.org
> Summary|[6/7/8/9 Regression]|[6/7/8 Regression] missing
>|missing -Warray-bounds on   |-Warray-bounds on an
>|an out-of-bounds index into |out-of-bounds index into an
>|an array|array
> 
> --- Comment #9 from Martin Sebor  ---
> Committed into GCC 9.0 in r262893.  All the test cases in this bug are now
> diagnosed.  Not sure if the fix will be approved for backporting though.

Please do not backport patches that re-introduce (possibly 
false-positive) warnings, at least for such long-standing "regressions"
like this.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-07-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
Summary|[6/7/8/9 Regression]|[6/7/8 Regression] missing
   |missing -Warray-bounds on   |-Warray-bounds on an
   |an out-of-bounds index into |out-of-bounds index into an
   |an array|array

--- Comment #9 from Martin Sebor  ---
Committed into GCC 9.0 in r262893.  All the test cases in this bug are now
diagnosed.  Not sure if the fix will be approved for backporting though.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-02-13 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Eric Gallager  changed:

   What|Removed |Added

   Keywords||patch
 CC||egallager at gcc dot gnu.org

--- Comment #7 from Eric Gallager  ---
(In reply to Martin Sebor from comment #6)
> I posted a patch for a similar issue reported in bug 83776
> (https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02144.html).  It handles
> MEM_REFs and diagnoses the test case in comment #0 (I must have missed that
> when I opened this bug) but it doesn't handle the test case in comment #2.

still worth adding the "patch" keyword to this one anyways, even if it only
handles one of the test cases.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-02-13 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com
   Target Milestone|6.5 |9.0

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

--- Comment #6 from Martin Sebor  ---
I posted a patch for a similar issue reported in bug 83776
(https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02144.html).  It handles
MEM_REFs and diagnoses the test case in comment #0 (I must have missed that
when I opened this bug) but it doesn't handle the test case in comment #2.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-26 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

--- Comment #5 from Aldy Hernandez  ---
Created attachment 43259
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43259=edit
proposed UNTESTED patch

(In reply to Jakub Jelinek from comment #4)
> I don't think we want to be adding new cases where -Warray-bounds will warn
> at this point, this warning has very high false positive rate and it is
> simply too late in the release cycle for that IMNSHO.  I'd retarget all
> similar PRs for GCC9.

Hmmm... this may be easy pickings though.

It looks like before the regression we had an ARRAY_REF we could diagnose:

  D.2720_5 = "12345678"[1073741824];

But now this is represented as:

  _1 = MEM[(const char *)"12345678" + 1073741824B];

I think we can just allow check_array_bounds() to handle MEM_REF's and
everything should just work.

The attached untested patch fixes the PR.  However, if you think this is not
worth pursuing, I can drop this and retarget this bug to GCC 9.

Your call Jakub.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
I don't think we want to be adding new cases where -Warray-bounds will warn at
this point, this warning has very high false positive rate and it is simply too
late in the release cycle for that IMNSHO.  I'd retarget all similar PRs for
GCC9.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-26 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Aldy Hernandez  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-26
 CC||aldyh at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Aldy Hernandez  ---
Confirmed, and confirmed that the regression started with r161655.

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

[Bug tree-optimization/84047] [6/7/8 Regression] missing -Warray-bounds on an out-of-bounds index into an array

2018-01-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84047

Martin Sebor  changed:

   What|Removed |Added

Summary|[6/7/8 Regression] missing  |[6/7/8 Regression] missing
   |-Warray-bounds on a |-Warray-bounds on an
   |negative offset into a  |out-of-bounds index into an
   |string  |array

--- Comment #2 from Martin Sebor  ---
Another test case with the same root cause, but this one with an array and a
small positive index:

char a[8];

int f (void)
{
  const char *s = a + 4;
  int i = 8;
  return s[i];   // missing -Warray-bounds
}