[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-09 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-10-09
 CC||law at redhat dot com
 Ever confirmed|0   |1

--- Comment #1 from Jeffrey A. Law  ---
My tester tripped this as well.  Confirming.

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
 Blocks||56456
   Target Milestone|--- |10.0

--- Comment #2 from Richard Biener  ---
The rev in question changed heuristics as to when unrolling is applied so the
issue is latent (and probably has a duplicate).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
[Bug 56456] [meta-bug] bogus/missing -Warray-bounds

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Richard Biener  changed:

   What|Removed |Added

   Keywords||needs-reduction

--- Comment #3 from Richard Biener  ---
_1235 = numsize.165_444 - densize_607;
_1236 = retval[_1235];

we compute _1235 to be in [-4,-1].  Directly after unrolling it was

  [../stdlib/strtod_l.c:1675:9] if (empty_1004 <= i_1232)
goto ; [80.00%]

   [local count: 284953]:
  [../stdlib/strtod_l.c:1676:25] _1235 = i_1232 - empty_1004;
  [../stdlib/strtod_l.c:1676:22] _1236 = [../stdlib/strtod_l.c:1676:22]
retval[_1235];

and forwprop "mangles" it to the above because

  empty_1004 = densize_425 - numsize.165_444;

and i_1232 is zero here.  That means the last unrolled iteration isn't
reachable.

Note we do complete peeling here (keeping the exit checks).  I had the
impression I disabled this for early unrolling...  hmm, I kept it for
UL_NO_GROWTH, see PR83202.

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-23 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-reduction |
 CC||marxin at gcc dot gnu.org

--- Comment #4 from Martin Liška  ---
Just for the record a reduced test-case:

int a[3];

void fn1(long b) {
  int i;
  for (i = 3; i >= b; --i)
a[i] = a[i - b];
}

where does not need -m32:

$ gcc -Werror=array-bounds -O2 -c ice.i
ice.i: In function ‘fn1’:
ice.i:6:6: error: array subscript 3 is above array bounds of ‘int[3]’
[-Werror=array-bounds]
6 | a[i] = a[i - b];
  | ~^~~
ice.i:1:5: note: while referencing ‘a’
1 | int a[3];
  | ^
cc1: some warnings being treated as errors

$ gcc-9 -Werror=array-bounds -O2 -c ice.i

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-10-23 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

--- Comment #5 from rguenther at suse dot de  ---
On Wed, 23 Oct 2019, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039
> 
> Martin Liška  changed:
> 
>What|Removed |Added
> 
>Keywords|needs-reduction |
>  CC||marxin at gcc dot gnu.org
> 
> --- Comment #4 from Martin Liška  ---
> Just for the record a reduced test-case:
> 
> int a[3];
> 
> void fn1(long b) {
>   int i;
>   for (i = 3; i >= b; --i)
> a[i] = a[i - b];
> }
> 
> where does not need -m32:
> 
> $ gcc -Werror=array-bounds -O2 -c ice.i
> ice.i: In function ‘fn1’:
> ice.i:6:6: error: array subscript 3 is above array bounds of ‘int[3]’
> [-Werror=array-bounds]
> 6 | a[i] = a[i - b];
>   | ~^~~
> ice.i:1:5: note: while referencing ‘a’
> 1 | int a[3];
>   | ^
> cc1: some warnings being treated as errors
> 
> $ gcc-9 -Werror=array-bounds -O2 -c ice.i

The testcase is probably misreduced since the very first iteration
will write to a[3] out of bounds so it only is valid if the loop
is not entered, thus if b < 3.

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-11-03 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

--- Comment #6 from Florian Weimer  ---
*** Bug 92337 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-11-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Fri Nov 15 09:09:16 2019
New Revision: 278281

URL: https://gcc.gnu.org/viewcvs?rev=278281&root=gcc&view=rev
Log:
2019-11-15  Richard Biener  

PR tree-optimization/92039
PR tree-optimization/91975
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Revert
previous change, treat invariants consistently as non-constant.
(tree_estimate_loop_size): Ternary ops with just the first op
constant are not optimized away.

* gcc.dg/tree-ssa/cunroll-2.c: Revert to state previous to
unroller adjustment.
* g++.dg/tree-ssa/ivopts-3.C: Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
trunk/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c
trunk/gcc/tree-ssa-loop-ivcanon.c

[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc

2019-11-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #7 from Richard Biener  ---
Fixed.