[Bug tree-optimization/56456] New: [meta-bug] bogus warning when inlining: "array subscript is above array bounds"

classic Classic list List threaded Threaded
60 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] New: [meta-bug] bogus warning when inlining: "array subscript is above array bounds"

msebor at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456



             Bug #: 56456

           Summary: [meta-bug] bogus warning when inlining: "array

                    subscript is above array bounds"

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: meta-bug

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: [hidden email]

        ReportedBy: [hidden email]

        Depends on: 35392, 38480, 41847, 45180, 45978, 47418, 53198
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining: "array subscript is above array bounds"

msebor at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456



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



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2013-02-26

     Ever Confirmed|0                           |1



--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-26 10:18:08 UTC ---

Confirmed.  Thanks for adding this meta-bug ...



General note: most of these bugs are symptoms for missed VRP opportunities

(though sometimes very hard to unleash).
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 53198, which changed state.

Bug 53198 Summary: [4.7 Regression] gcc wrongly emits "array subscript is above array bounds" for simple arrays
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53198

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 56273, which changed state.

Bug 56273 Summary: [4.8 regression] Bogus -Warray-bounds warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 41847, which changed state.

Bug 41847 Summary: warning: array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

Mason <slash.tmp at free dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely.gcc at gmail dot com,
                   |                            |law at redhat dot com,
                   |                            |rguenth at gcc dot gnu.org,
                   |                            |slash.tmp at free dot fr

--- Comment #2 from Mason <slash.tmp at free dot fr> ---
A few more bugs should be added to this tracker:
(It seems I don't have permission to do that?)

bug 59124
bug 63441
bug 63477
bug 80907
bug 82286

Adding my own testcase here:

extern int array[3];
void foo(int n)
{
        for (int i = 0; i < n; ++i)
                for (int j = 0; j < i; ++j)
                        if (array[i] == array[j])
                                array[j] = 0;
}

gcc -Wall -O3 test.c triggers bogus warning(s) with any version of gcc >= 4.8
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 47418, which changed state.

Bug 47418 Summary: warning: array subscript is above array bounds at O2 with sin6_addr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47418

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 45180, which changed state.

Bug 45180 Summary: bogus warning: array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45180

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 38480, which changed state.

Bug 38480 Summary: bogus warning with -O3 -Wall: "array subscript is above array bounds"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38480

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

Eric Gallager <egallager at gcc dot gnu.org> changed:

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

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
How essential is the "when inlining or unrolling" portion of the title for this
bug? i.e., can it be used as a meta-bug for all -Warray-bounds issues? If not,
how to tell if any given -Warray-bounds bug is related to inlining/unrolling or
not?
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 17 Oct 2017, egallager at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
>
> Eric Gallager <egallager at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |egallager at gcc dot gnu.org
>
> --- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> --- How
> essential is the "when inlining or unrolling" portion of the title for
> this bug? i.e., can it be used as a meta-bug for all -Warray-bounds
> issues? If not, how to tell if any given -Warray-bounds bug is related
> to inlining/unrolling or not?

It's hard to tell.  Unless we have another meta-bug just re-use this one.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

--- Comment #5 from Mason <slash.tmp at free dot fr> ---
Slightly smaller testcase, similar to bug 80907.

extern int M[16];
void foo(int n)
{
        for (int i = 0; i < n; ++i)
                for (int j = 0; j < i; ++j)
                        M[i+j] = 0;
}

$ gcc-7 -O3 -Wall -S testcase4.c
testcase4.c: In function 'foo':
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
    M[i+j] = 0;
    ~^~~~~
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]

Same result with trunk.

Using -fopt-info adds:
testcase4.c:5:3: note: loop turned into non-loop; it never loops.
testcase4.c:5:3: note: loop with 17 iterations completely unrolled
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing warning (when inlining or unrolling): "array subscript is above array bounds" [-Warray-bounds]

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |82596, 82588, 82585, 82583,
                   |                            |82581, 69224, 82455
            Summary|[meta-bug] bogus warning    |[meta-bug] bogus/missing
                   |when inlining or unrolling: |warning (when inlining or
                   |"array subscript is above   |unrolling): "array
                   |array bounds"               |subscript is above array
                   |                            |bounds" [-Warray-bounds]
              Alias|                            |Warray-bounds

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to [hidden email] from comment #4)
>
> It's hard to tell.  Unless we have another meta-bug just re-use this one.

I couldn't find another one that looked relevant so I'll re-use this one.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69224
[Bug 69224] [6/7/8 Regression] -Warray-bounds false positive with -O3 and
struct pointer parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82455
[Bug 82455] missing -Warray-bounds on strcpy offset in an out-of-bounds range
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82581
[Bug 82581] missing -Warray-bounds on writing past the end of a member array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82583
[Bug 82583] missing -Warray-bounds on out-of-bounds inner indices
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82585
[Bug 82585] missing -Warray-bounds calling strlen on a member at out-of-bounds
offfset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82588
[Bug 82588] missing -Warray-bounds on a excessively large index
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82596
[Bug 82596] missing -Warray-bounds on an out-of-bounds index into string
literal
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
            Summary|[meta-bug] bogus/missing    |[meta-bug] bogus/missing
                   |warning (when inlining or   |-Warray-bounds
                   |unrolling): "array          |
                   |subscript is above array    |
                   |bounds" [-Warray-bounds]    |

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Now that this bug has become a tracker for both false positives and false
negatives the inlining/unrolling part is not relevant anymore so adjusting the
Summary.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 82596, which changed state.

Bug 82596 Summary: missing -Warray-bounds on an out-of-bounds index into string literal
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82596

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 82583, which changed state.

Bug 82583 Summary: missing -Warray-bounds on out-of-bounds inner indices
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82583

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 82588, which changed state.

Bug 82588 Summary: missing -Warray-bounds on a excessively large index
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82588

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 59124, which changed state.

Bug 59124 Summary: [6 Regression] Wrong warnings "array subscript is above array bounds"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 63477, which changed state.

Bug 63477 Summary: [6/7/8 Regression] Bogus warning with -O3 -Warray-bounds: array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63477

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 63441, which changed state.

Bug 63441 Summary: incorrect "array subscript is below/above array bounds" diagnostic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63441

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME
123