[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-24 Thread amodra at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

--- Comment #6 from Alan Modra  ---
(In reply to Martin Sebor from comment #5)
> The -Warray-bounds for section.c is gone
Thanks for fixing that.

> but last night's build still shows
> a large number of -Warray-bounds instances as well as other warnings for
> Binutils &  GDB.
I built gcc and binutils+gdb just now and see that these are all in sim/ with
the exception of -Wconflicts-sr and -Wconflicts-rr bison warnings, and this
libstdc++ warning:

home/alan/build/gcc-virgin/prev-x86_64-linux/libstdc++-v3/include/bits/stl_algo.h:1869:32:
error: array subscript 19 is outside array bounds of ‘void [136]’
[-Werror=array-bounds]

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-24 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

--- Comment #5 from Martin Sebor  ---
The -Warray-bounds for section.c is gone but last night's build still shows a
large number of -Warray-bounds instances as well as other warnings for Binutils
&  GDB.  I haven't analyzed any of them.  The breakdown is below:

DiagnosticCount   UniqueFiles
-Wimplicit-function-declaration   99   70   15
-Warray-bounds   7911
-Wpointer-sign   54   548
-Wmaybe-uninitialized43   37   22
-Wmissing-prototypes 42   329
-Wincompatible-pointer-types 42   421
-Wpointer-to-int-cast11   112
-Wparentheses11   113
-Wint-to-pointer-cast 991
-Wformat= 632
-Walloc-zero  622
-Wconflicts-sr555
-Wunused-value311
-Wunused-function 331
-Wstrict-aliasing 331
-Wdangling-else   221
-Wmisleading-indentation  111
-Wconflicts-rr111

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-24 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
Fixed.

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-24 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977
Bug 101977 depends on bug 101600, which changed state.

Bug 101600 Summary: [12 Regression] Spurious -Warray-bounds downcasting a 
polymorphic pointer
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101600

   What|Removed |Added

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

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-24 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:820f0940d7ace1306430a9dcf1bd9577508a7a7e

commit r12-3124-g820f0940d7ace1306430a9dcf1bd9577508a7a7e
Author: Martin Sebor 
Date:   Tue Aug 24 10:49:11 2021 -0600

Reset PHI base0 flag if it's clear in any argument [PR101977, ...]

Resolves:
PR middle-end/101600 - Spurious -Warray-bounds downcasting a polymorphic
pointer
PR middle-end/101977 - bogus -Warray-bounds on a negative index into a
parameter in conditional with null

gcc/ChangeLog:

PR middle-end/101600
PR middle-end/101977
* gimple-ssa-warn-access.cc (maybe_warn_for_bound): Tighten up
the phrasing of a warning.
(check_access): Use the remaining size after subtracting any offset
rather than the whole object size.
* pointer-query.cc (access_ref::get_ref): Clear BASE0 flag if it's
clear for any nonnull PHI argument.
(compute_objsize): Clear argument.

gcc/testsuite/ChangeLog:

PR middle-end/101600
PR middle-end/101977
* g++.dg/pr100574.C: Prune out valid warning.
* gcc.dg/pr20126.c: Same.
* gcc.dg/Wstringop-overread.c: Adjust text of expected warnings.
Add new instances.
* gcc.dg/warn-strnlen-no-nul.c: Same.
* g++.dg/warn/Warray-bounds-26.C: New test.
* gcc.dg/Warray-bounds-88.c: New test.

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-23 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577985.html

[Bug tree-optimization/101977] [12 Regression] array subscript 0 is outside array bounds

2021-08-19 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101977

Martin Sebor  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org