public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
@ 2014-12-11 20:42 aivchenk at gmail dot com
  2014-12-12  9:36 ` [Bug tree-optimization/64277] " rguenth at gcc dot gnu.org
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: aivchenk at gmail dot com @ 2014-12-11 20:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

            Bug ID: 64277
           Summary: [4.9/5.0 Regression] Incorrect warning "array
                    subscript is above array bounds"
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aivchenk at gmail dot com

>cat test.c
void foo(short a[], short m)                                                    
{                                                                               
  int i, j;                                                                     
  int f1[10];                                                                   
  short nc;                                                                     

  nc = m + 1;                                                                   
  if (nc > 3)                                                                   
    {                                                                           
      for (i = 0; i <= nc; i++)                                                 
        {                                                                       
          f1[i] = f1[i] + 1;                                                    
        }                                                                       
    }                                                                           

  for (i = 0, j = m; i < nc; i++, j--)                                          
    {                                                                           
      a[i] = f1[i];                                                             
      a[j] = i;                                                                 
    }                                                                           
  return;                                                                       
}                          
>gcc -O3 -mssse3 -Wall
/export/users/aivchenk/src/gcc_obj/test.c:21:16: warning: array subscript is
above array bounds [-Warray-bounds]
       a[i] = f1[i]; 
                ^

If compile with "-msse3" there is no warning.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
@ 2014-12-12  9:36 ` rguenth at gcc dot gnu.org
  2014-12-23 17:35 ` izamyatin at gmail dot com
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-12  9:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.3


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
  2014-12-12  9:36 ` [Bug tree-optimization/64277] " rguenth at gcc dot gnu.org
@ 2014-12-23 17:35 ` izamyatin at gmail dot com
  2014-12-23 20:19 ` manu at gcc dot gnu.org
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: izamyatin at gmail dot com @ 2014-12-23 17:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Igor Zamyatin <izamyatin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |izamyatin at gmail dot com

--- Comment #1 from Igor Zamyatin <izamyatin at gmail dot com> ---
Warnings are issued by vrp2.

It happens when we have both vector and scalar versions of code. Something
seems to confuse VRP analysis, probably the reason is that m and nc are shorts.
Changing them to int makes warnings disappear


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
  2014-12-12  9:36 ` [Bug tree-optimization/64277] " rguenth at gcc dot gnu.org
  2014-12-23 17:35 ` izamyatin at gmail dot com
@ 2014-12-23 20:19 ` manu at gcc dot gnu.org
  2014-12-23 20:58 ` aivchenk at gmail dot com
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2014-12-23 20:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I cannot reproduce this in GCC 5.0 with or without -msse3 (on
x86_64-linux-gnu). I always get:

test.c: In function ‘foo’:
test.c:12:14: warning: ‘f1’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
    f1[i] = f1[i] + 1;
              ^

which seems correct.

In any case, warning about f1[i] being above array bounds would be correct:
there is no check that "i < 10".
>From gcc-bugs-return-471665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 23 20:23:01 2014
Return-Path: <gcc-bugs-return-471665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19976 invoked by alias); 23 Dec 2014 20:23:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19946 invoked by uid 48); 23 Dec 2014 20:22:56 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/64390] "-shared" does not resolve symbols from lto generated archives
Date: Tue, 23 Dec 2014 20:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-64390-4-A9Q4tsbGgQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64390-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64390-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg02672.txt.bz2
Content-length: 489

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd390

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-12-23
     Ever confirmed|0                           |1

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Can you try binutils 2.25?


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (2 preceding siblings ...)
  2014-12-23 20:19 ` manu at gcc dot gnu.org
@ 2014-12-23 20:58 ` aivchenk at gmail dot com
  2015-01-12  8:50 ` izamyatin at gmail dot com
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: aivchenk at gmail dot com @ 2014-12-23 20:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #3 from Alexander Ivchenko <aivchenk at gmail dot com> ---
You need to specify "-mssse3" (not "-msse3"). Warning about array bounds is not
correct, because gcc does not know how this function is being called.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (3 preceding siblings ...)
  2014-12-23 20:58 ` aivchenk at gmail dot com
@ 2015-01-12  8:50 ` izamyatin at gmail dot com
  2015-01-15  9:05 ` izamyatin at gmail dot com
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: izamyatin at gmail dot com @ 2015-01-12  8:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #4 from Igor Zamyatin <izamyatin at gmail dot com> ---
See the warning ( used -O3 -mssse3 -Wall) on current trunk configured as

../configure --enable-clocale=gnu --with-system-zlib --enable-shared
--with-demangler-in-ld --with-fpmath=sse --enable-checking=release
--enable-languages=c,c++,fortran


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (4 preceding siblings ...)
  2015-01-12  8:50 ` izamyatin at gmail dot com
@ 2015-01-15  9:05 ` izamyatin at gmail dot com
  2015-01-21 15:02 ` [Bug tree-optimization/64277] [4.9/5 " izamyatin at gmail dot com
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: izamyatin at gmail dot com @ 2015-01-15  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #5 from Igor Zamyatin <izamyatin at gmail dot com> ---
BTW, making nc and m to be int instead short eliminates the warning


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (5 preceding siblings ...)
  2015-01-15  9:05 ` izamyatin at gmail dot com
@ 2015-01-21 15:02 ` izamyatin at gmail dot com
  2015-01-26 12:33 ` enkovich.gnu at gmail dot com
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: izamyatin at gmail dot com @ 2015-01-21 15:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #6 from Igor Zamyatin <izamyatin at gmail dot com> ---
cunroll phase 7 times completely unrolls post-loop that was generated by
vectorizer.

And later vrp complains on those unrolled iterations.

Note that for the test without if (nc > 3), i.e.

void foo(short a[], short m)
{
  int i,j;
  int f1[10];
  short nc;

  nc = m + 1;
  for (i = 0, j = m; i < nc; i++, j--)
    {
      a[i] = f1[i];
      a[j] = i;
    }
  return;
}

vrp doesn't complain while cunroll still performs 7 times complete unroll.

Most probably merge block generated for the original testcase affects vrp's
work:

  <bb 14>:
  # prephitmp_39 = PHI <pretmp_40(3), _450(13), _451(40)>
  j_18 = (int) m_7(D);
  if (prephitmp_39 > 0)
    goto <bb 16>;
  else
    goto <bb 15>;


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (7 preceding siblings ...)
  2015-01-26 12:33 ` enkovich.gnu at gmail dot com
@ 2015-01-26 12:33 ` enkovich.gnu at gmail dot com
  2015-01-26 12:43 ` rguenth at gcc dot gnu.org
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: enkovich.gnu at gmail dot com @ 2015-01-26 12:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #8 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Created attachment 34569
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34569&action=edit
patch to disable warnings for array references generated by cunroll


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (6 preceding siblings ...)
  2015-01-21 15:02 ` [Bug tree-optimization/64277] [4.9/5 " izamyatin at gmail dot com
@ 2015-01-26 12:33 ` enkovich.gnu at gmail dot com
  2015-01-26 12:33 ` enkovich.gnu at gmail dot com
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: enkovich.gnu at gmail dot com @ 2015-01-26 12:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #9 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Nice solution for this problem would be to have a better estimation of maximum
loop iterations number.  Currently array size and index step are used to get
the maximum ignoring starting index value range.

Another way to solve the problem is to disable warnings for code generated by
cunroll in case it cannot compute exact number of iterations.  I attach a patch
which does it.

This bug is hit multiple times on Android build with GCC 4.9.  With this fix we
have a clean Android build with GCC 4.9.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (8 preceding siblings ...)
  2015-01-26 12:33 ` enkovich.gnu at gmail dot com
@ 2015-01-26 12:43 ` rguenth at gcc dot gnu.org
  2015-01-26 13:34 ` rguenth at gcc dot gnu.org
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-26 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Priority|P3                          |P2

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ick - that will also paper over good warnings so I'd rather not do that.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (9 preceding siblings ...)
  2015-01-26 12:43 ` rguenth at gcc dot gnu.org
@ 2015-01-26 13:34 ` rguenth at gcc dot gnu.org
  2015-01-26 13:51 ` enkovich.gnu at gmail dot com
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-26 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-26
     Ever confirmed|0                           |1

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed btw.  I believe we have plenty of dups of this report - it is usually
the last peeled iteration we warn for.

The interesting thing is that we have

  # RANGE [1, 11] NONZERO 15
  i_385 = i_369 + 1;
...
  <bb 52>:
  # RANGE [1, 11] NONZERO 15
  i_461 = ASSERT_EXPR <i_385, i_385 < prephitmp_422>;
...
  <bb 20>:
  # RANGE [0, 10] NONZERO 15
  # i_82 = PHI <i_461(52)>

still we compute

i_461: [14, 32766]  EQUIVALENCES: { i_385 } (1 elements)

so sth is bogus here (the above ranges are simply copied in unrolling
but that's ok - they are conservatively correct).

We should be able to rely on the previous ranges and use them to our advantage,
like with

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c      (revision 220107)
+++ gcc/tree-vrp.c      (working copy)
@@ -847,6 +847,23 @@ update_value_range (const_tree var, valu
   value_range_t *old_vr;
   bool is_new;

+  /* If there is a value-range on the SSA name from earlier analysis
+     factor that in.  */
+  if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
+    {
+      wide_int min, max;
+      value_range_type rtype = get_range_info (var, &min, &max);
+      if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
+       {
+         value_range_d nr;
+         nr.type = rtype;
+         nr.min = wide_int_to_tree (TREE_TYPE (var), min);
+         nr.max = wide_int_to_tree (TREE_TYPE (var), max);
+         nr.equiv = NULL;
+         vrp_intersect_ranges (new_vr, &nr);
+       }
+    }
+
   /* Update the value range, if necessary.  */
   old_vr = get_value_range (var);
   is_new = old_vr->type != new_vr->type

which cuts down the number of warnings to

t.c: In function 'foo':
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
       a[i] = f1[i];
                ^
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
t.c:12:14: warning: 'f1' may be used uninitialized in this function
[-Wmaybe-uninitialized]
    f1[i] = f1[i] + 1;
              ^
from

t.c: In function 'foo':
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
       a[i] = f1[i];
                ^
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
t.c:18:16: warning: array subscript is above array bounds [-Warray-bounds]
t.c:12:14: warning: 'f1' may be used uninitialized in this function
[-Wmaybe-uninitialized]
    f1[i] = f1[i] + 1;
              ^


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (10 preceding siblings ...)
  2015-01-26 13:34 ` rguenth at gcc dot gnu.org
@ 2015-01-26 13:51 ` enkovich.gnu at gmail dot com
  2015-01-26 15:08 ` enkovich.gnu at gmail dot com
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: enkovich.gnu at gmail dot com @ 2015-01-26 13:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #12 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
(In reply to Richard Biener from comment #10)
> Ick - that will also paper over good warnings so I'd rather not do that.

I'm also worried about possible good warnings removal.  Thus I disable them
only in case cunroll speculates about iterations number and never disable them
for the first loop iteration.

I agree warnings disabling looks like a workaround.  But it doesn't seem
correct to complain on code generated by compiler and probably never executed. 
Each time maxiter is used for complete unroll following optimizations may
improve maxiter estimation and thus we get a compiler generated dead code which
still may produce warnings.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (11 preceding siblings ...)
  2015-01-26 13:51 ` enkovich.gnu at gmail dot com
@ 2015-01-26 15:08 ` enkovich.gnu at gmail dot com
  2015-01-27  9:51 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: enkovich.gnu at gmail dot com @ 2015-01-26 15:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #13 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Ranges have to be used for maxiter computations to have consistent analysis in
complete unroll and vrp.  Following patch allows to refine maxiter estimation
using ranges and avoid warnings.

diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 919f5c0..14cce2a 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2754,6 +2754,7 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree
step, gimple stmt,
 {
   tree niter_bound, extreme, delta;
   tree type = TREE_TYPE (base), unsigned_type;
+  tree orig_base = base;

   if (TREE_CODE (step) != INTEGER_CST || integer_zerop (step))
     return;
@@ -2777,7 +2778,14 @@ record_nonwrapping_iv (struct loop *loop, tree base,
tree step, gimple stmt,

   if (tree_int_cst_sign_bit (step))
     {
+      wide_int min, max, highwi = high;
       extreme = fold_convert (unsigned_type, low);
+      if (TREE_CODE (orig_base) == SSA_NAME
+         && !POINTER_TYPE_P (TREE_TYPE (orig_base))
+         && SSA_NAME_RANGE_INFO (orig_base)
+         && get_range_info (orig_base, &min, &max) == VR_RANGE
+         && wi::gts_p (highwi, max))
+       base = wide_int_to_tree (unsigned_type, max);
       if (TREE_CODE (base) != INTEGER_CST)
        base = fold_convert (unsigned_type, high);
       delta = fold_build2 (MINUS_EXPR, unsigned_type, base, extreme);
@@ -2785,8 +2793,15 @@ record_nonwrapping_iv (struct loop *loop, tree base,
tree step, gimple stmt,
     }
   else
     {
+      wide_int min, max, lowwi = low;
       extreme = fold_convert (unsigned_type, high);
-      if (TREE_CODE (base) != INTEGER_CST)
+      if (TREE_CODE (orig_base) == SSA_NAME
+         && !POINTER_TYPE_P (TREE_TYPE (orig_base))
+         && SSA_NAME_RANGE_INFO (orig_base)
+         && get_range_info (orig_base, &min, &max) == VR_RANGE
+         && wi::gts_p (min, lowwi))
+       base = wide_int_to_tree (unsigned_type, min);
+      else if (TREE_CODE (base) != INTEGER_CST)
        base = fold_convert (unsigned_type, low);
       delta = fold_build2 (MINUS_EXPR, unsigned_type, extreme, base);
     }
diff --git a/gcc/testsuite/gcc.dg/pr64277.c b/gcc/testsuite/gcc.dg/pr64277.c
new file mode 100644
index 0000000..0d5ef11
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64277.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/64277 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wall -Werror" } */
+
+
+int f1[10];
+void test1 (short a[], short m, unsigned short l)
+{
+  int i = l;
+  for (i = i + 5; i < m; i++)
+    f1[i] = a[i]++;
+}
+
+void test2 (short a[], short m, short l)
+{
+  int i;
+  if (m > 5)
+    m = 5;
+  for (i = m; i > l; i--)
+    f1[i] = a[i]++;
+}


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (12 preceding siblings ...)
  2015-01-26 15:08 ` enkovich.gnu at gmail dot com
@ 2015-01-27  9:51 ` rguenth at gcc dot gnu.org
  2015-01-27  9:52 ` [Bug tree-optimization/64277] [4.9 " rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-27  9:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jan 27 09:49:29 2015
New Revision: 220157

URL: https://gcc.gnu.org/viewcvs?rev=220157&root=gcc&view=rev
Log:
2015-01-27  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/56273
    PR tree-optimization/59124
    PR tree-optimization/64277
    * tree-vrp.c (vrp_finalize): Emit array-bound warnings only
    from the first VRP pass.

    * g++.dg/warn/Warray-bounds-6.C: New testcase.
    * gcc.dg/Warray-bounds-12.c: Likewise.
    * gcc.dg/Warray-bounds-13.c: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
    trunk/gcc/testsuite/gcc.dg/Warray-bounds-12.c
    trunk/gcc/testsuite/gcc.dg/Warray-bounds-13.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (13 preceding siblings ...)
  2015-01-27  9:51 ` rguenth at gcc dot gnu.org
@ 2015-01-27  9:52 ` rguenth at gcc dot gnu.org
  2015-01-27 10:04 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-27  9:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |5.0
            Summary|[4.9/5 Regression]          |[4.9 Regression] Incorrect
                   |Incorrect warning "array    |warning "array subscript is
                   |subscript is above array    |above array bounds"
                   |bounds"                     |

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 5.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (14 preceding siblings ...)
  2015-01-27  9:52 ` [Bug tree-optimization/64277] [4.9 " rguenth at gcc dot gnu.org
@ 2015-01-27 10:04 ` rguenth at gcc dot gnu.org
  2015-01-27 11:04 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-27 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Ilya Enkovich from comment #13)
> Ranges have to be used for maxiter computations to have consistent analysis
> in complete unroll and vrp.  Following patch allows to refine maxiter
> estimation using ranges and avoid warnings.

Looks good to me with...

> diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
> index 919f5c0..14cce2a 100644
> --- a/gcc/tree-ssa-loop-niter.c
> +++ b/gcc/tree-ssa-loop-niter.c
> @@ -2754,6 +2754,7 @@ record_nonwrapping_iv (struct loop *loop, tree base,
> tree step, gimple stmt,
>  {
>    tree niter_bound, extreme, delta;
>    tree type = TREE_TYPE (base), unsigned_type;
> +  tree orig_base = base;
> 
>    if (TREE_CODE (step) != INTEGER_CST || integer_zerop (step))
>      return;
> @@ -2777,7 +2778,14 @@ record_nonwrapping_iv (struct loop *loop, tree base,
> tree step, gimple stmt,
> 
>    if (tree_int_cst_sign_bit (step))
>      {
> +      wide_int min, max, highwi = high;
>        extreme = fold_convert (unsigned_type, low);
> +      if (TREE_CODE (orig_base) == SSA_NAME
> +         && !POINTER_TYPE_P (TREE_TYPE (orig_base))

  test

         INTEGRAL_TYPE_P (TREE_TYPE (orig_base))

instead

> +         && SSA_NAME_RANGE_INFO (orig_base)

You can drop this check, get_range_info will return VR_VARYING.

> +         && get_range_info (orig_base, &min, &max) == VR_RANGE
> +         && wi::gts_p (highwi, max))

I think you can write

            && wi::gts_p (high.to_widest (), max))

and avoid the highwi temporary.

Similar changes below.

> +       base = wide_int_to_tree (unsigned_type, max);
>        if (TREE_CODE (base) != INTEGER_CST)
>         base = fold_convert (unsigned_type, high);
>        delta = fold_build2 (MINUS_EXPR, unsigned_type, base, extreme);
> @@ -2785,8 +2793,15 @@ record_nonwrapping_iv (struct loop *loop, tree base,
> tree step, gimple stmt,
>      }
>    else
>      {
> +      wide_int min, max, lowwi = low;
>        extreme = fold_convert (unsigned_type, high);
> -      if (TREE_CODE (base) != INTEGER_CST)
> +      if (TREE_CODE (orig_base) == SSA_NAME
> +         && !POINTER_TYPE_P (TREE_TYPE (orig_base))
> +         && SSA_NAME_RANGE_INFO (orig_base)
> +         && get_range_info (orig_base, &min, &max) == VR_RANGE
> +         && wi::gts_p (min, lowwi))
> +       base = wide_int_to_tree (unsigned_type, min);
> +      else if (TREE_CODE (base) != INTEGER_CST)
>         base = fold_convert (unsigned_type, low);
>        delta = fold_build2 (MINUS_EXPR, unsigned_type, extreme, base);
>      }
> diff --git a/gcc/testsuite/gcc.dg/pr64277.c b/gcc/testsuite/gcc.dg/pr64277.c
> new file mode 100644
> index 0000000..0d5ef11
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr64277.c
> @@ -0,0 +1,21 @@
> +/* PR tree-optimization/64277 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -Wall -Werror" } */
> +
> +
> +int f1[10];
> +void test1 (short a[], short m, unsigned short l)
> +{
> +  int i = l;
> +  for (i = i + 5; i < m; i++)
> +    f1[i] = a[i]++;
> +}
> +
> +void test2 (short a[], short m, short l)
> +{
> +  int i;
> +  if (m > 5)
> +    m = 5;
> +  for (i = m; i > l; i--)
> +    f1[i] = a[i]++;
> +}


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (15 preceding siblings ...)
  2015-01-27 10:04 ` rguenth at gcc dot gnu.org
@ 2015-01-27 11:04 ` rguenth at gcc dot gnu.org
  2015-01-28 11:42 ` ienkovich at gcc dot gnu.org
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-27 11:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine for backporting.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (16 preceding siblings ...)
  2015-01-27 11:04 ` rguenth at gcc dot gnu.org
@ 2015-01-28 11:42 ` ienkovich at gcc dot gnu.org
  2015-01-28 22:15 ` rth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: ienkovich at gcc dot gnu.org @ 2015-01-28 11:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #18 from ienkovich at gcc dot gnu.org ---
Author: ienkovich
Date: Wed Jan 28 11:41:40 2015
New Revision: 220204

URL: https://gcc.gnu.org/viewcvs?rev=220204&root=gcc&view=rev
Log:
gcc/

    PR tree-optimization/64277
    * tree-ssa-loop-niter.c (record_nonwrapping_iv): Use base
    range info when possible to refine estimation.

gcc/testsuite/

    PR tree-optimization/64277
    * gcc.dg/pr64277.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/pr64277.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-niter.c


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (17 preceding siblings ...)
  2015-01-28 11:42 ` ienkovich at gcc dot gnu.org
@ 2015-01-28 22:15 ` rth at gcc dot gnu.org
  2015-02-19 14:14 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rth at gcc dot gnu.org @ 2015-01-28 22:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Henderson <rth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at redhat dot com

--- Comment #19 from Richard Henderson <rth at gcc dot gnu.org> ---
*** Bug 64739 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (18 preceding siblings ...)
  2015-01-28 22:15 ` rth at gcc dot gnu.org
@ 2015-02-19 14:14 ` rguenth at gcc dot gnu.org
  2015-02-19 14:15 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-19 14:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Feb 19 14:13:16 2015
New Revision: 220815

URL: https://gcc.gnu.org/viewcvs?rev=220815&root=gcc&view=rev
Log:
2015-02-19  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-12-09  Richard Biener  <rguenther@suse.de>

    PR middle-end/64199
    * fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P.

    * gcc.dg/torture/pr64199.c: New testcase.

    2015-01-14  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/64493
    PR tree-optimization/64495
    * tree-vect-loop.c (vect_finalize_reduction): For double-reductions
    assign the proper vectorized PHI to the inner loop exit PHIs.

    * gcc.dg/vect/pr64493.c: New testcase.
    * gcc.dg/vect/pr64495.c: Likewise.

    2015-01-27  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/56273
    PR tree-optimization/59124
    PR tree-optimization/64277
    * tree-vrp.c (vrp_finalize): Emit array-bound warnings only
    from the first VRP pass.

    * g++.dg/warn/Warray-bounds-6.C: New testcase.
    * gcc.dg/Warray-bounds-12.c: Likewise.
    * gcc.dg/Warray-bounds-13.c: Likewise.

    2015-02-19  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2015-01-15  Richard Biener  <rguenther@suse.de>

    PR middle-end/64365
    * tree-data-ref.c (dr_analyze_indices): Make sure that accesses
    for MEM_REF access functions with the same base can never partially
    overlap.

    * gcc.dg/torture/pr64365.c: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/Warray-bounds-12.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/Warray-bounds-13.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr64199.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr64365.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr64493.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr64495.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/fold-const.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-data-ref.c
    branches/gcc-4_9-branch/gcc/tree-vect-loop.c
    branches/gcc-4_9-branch/gcc/tree-vrp.c


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (19 preceding siblings ...)
  2015-02-19 14:14 ` rguenth at gcc dot gnu.org
@ 2015-02-19 14:15 ` rguenth at gcc dot gnu.org
  2015-02-24 13:05 ` rguenth at gcc dot gnu.org
  2015-04-16 12:03 ` rguenth at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-19 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.8.4, 4.9.3
         Resolution|---                         |FIXED
      Known to fail|                            |4.9.2

--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (20 preceding siblings ...)
  2015-02-19 14:15 ` rguenth at gcc dot gnu.org
@ 2015-02-24 13:05 ` rguenth at gcc dot gnu.org
  2015-04-16 12:03 ` rguenth at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-24 13:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #22 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Feb 24 12:49:11 2015
New Revision: 220939

URL: https://gcc.gnu.org/viewcvs?rev=220939&root=gcc&view=rev
Log:
2015-02-24  Richard Biener  <rguenther@suse.de>

        Backport from mainline
        2015-01-27  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/56273
    PR tree-optimization/59124
    PR tree-optimization/64277
    * tree-vrp.c (vrp_finalize): Emit array-bound warnings only
    from the first VRP pass.

    * g++.dg/warn/Warray-bounds-6.C: New testcase.
    * gcc.dg/Warray-bounds-12.c: Likewise.
    * gcc.dg/Warray-bounds-13.c: Likewise.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/Warray-bounds-12.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/Warray-bounds-13.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-vrp.c


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug tree-optimization/64277] [4.9 Regression] Incorrect warning "array subscript is above array bounds"
  2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
                   ` (21 preceding siblings ...)
  2015-02-24 13:05 ` rguenth at gcc dot gnu.org
@ 2015-04-16 12:03 ` rguenth at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-04-16 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Apr 16 12:03:11 2015
New Revision: 222146

URL: https://gcc.gnu.org/viewcvs?rev=222146&root=gcc&view=rev
Log:
2015-04-16  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/64277
    * tree-vrp.c (check_array_ref): Fix anti-range handling,
    simplify upper bound handling.
    (search_for_addr_array): Simplify.
    (check_array_bounds): Handle ADDR_EXPRs here.
    (check_all_array_refs): Simplify.

    * gcc.dg/Warray-bounds-14.c: New testcase.
    * gcc.dg/Warray-bounds-15.c: Likewise.
    * c-c++-common/ubsan/bounds-4.c: Disable -Warray-bounds.
    * c-c++-common/ubsan/bounds-6.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/Warray-bounds-14.c
    trunk/gcc/testsuite/gcc.dg/Warray-bounds-15.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/ubsan/bounds-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/bounds-6.c
    trunk/gcc/tree-vrp.c


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-04-16 12:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 20:42 [Bug tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds" aivchenk at gmail dot com
2014-12-12  9:36 ` [Bug tree-optimization/64277] " rguenth at gcc dot gnu.org
2014-12-23 17:35 ` izamyatin at gmail dot com
2014-12-23 20:19 ` manu at gcc dot gnu.org
2014-12-23 20:58 ` aivchenk at gmail dot com
2015-01-12  8:50 ` izamyatin at gmail dot com
2015-01-15  9:05 ` izamyatin at gmail dot com
2015-01-21 15:02 ` [Bug tree-optimization/64277] [4.9/5 " izamyatin at gmail dot com
2015-01-26 12:33 ` enkovich.gnu at gmail dot com
2015-01-26 12:33 ` enkovich.gnu at gmail dot com
2015-01-26 12:43 ` rguenth at gcc dot gnu.org
2015-01-26 13:34 ` rguenth at gcc dot gnu.org
2015-01-26 13:51 ` enkovich.gnu at gmail dot com
2015-01-26 15:08 ` enkovich.gnu at gmail dot com
2015-01-27  9:51 ` rguenth at gcc dot gnu.org
2015-01-27  9:52 ` [Bug tree-optimization/64277] [4.9 " rguenth at gcc dot gnu.org
2015-01-27 10:04 ` rguenth at gcc dot gnu.org
2015-01-27 11:04 ` rguenth at gcc dot gnu.org
2015-01-28 11:42 ` ienkovich at gcc dot gnu.org
2015-01-28 22:15 ` rth at gcc dot gnu.org
2015-02-19 14:14 ` rguenth at gcc dot gnu.org
2015-02-19 14:15 ` rguenth at gcc dot gnu.org
2015-02-24 13:05 ` rguenth at gcc dot gnu.org
2015-04-16 12:03 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).