public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53890] New: bogus array bounds warning
@ 2012-07-07 20:30 nathan at acm dot org
  2012-07-07 21:27 ` [Bug c/53890] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nathan at acm dot org @ 2012-07-07 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53890
           Summary: bogus array bounds warning
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nathan@acm.org


Created attachment 27761
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27761
test case

compile the attached with:
./cc1 ary.cc -O2 -Wall -quiet

(don't worry that it's a .cc file, I found the bug in c++ code, but it
manifests in both C and C++ compilers)

see following warning:

ary.cc: In function 'Foo':
ary.cc:12:6: warning: array subscript is above array bounds [-Warray-bounds]
   tmp[jx] = 4;
      ^

This is incorrect, the compiler cannot deduce that jx is out of range at this
point -- indeed in correct calls of Foo it won't be.


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

* [Bug c/53890] bogus array bounds warning
  2012-07-07 20:30 [Bug c/53890] New: bogus array bounds warning nathan at acm dot org
@ 2012-07-07 21:27 ` pinskia at gcc dot gnu.org
  2012-07-09  8:39 ` rguenth at gcc dot gnu.org
  2020-05-19 21:07 ` [Bug middle-end/53890] " msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-07-07 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-07-07 21:27:27 UTC ---
What happens here is that we do a jump threading for the case where words == 0
which produces an out of bounds array reference.


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

* [Bug c/53890] bogus array bounds warning
  2012-07-07 20:30 [Bug c/53890] New: bogus array bounds warning nathan at acm dot org
  2012-07-07 21:27 ` [Bug c/53890] " pinskia at gcc dot gnu.org
@ 2012-07-09  8:39 ` rguenth at gcc dot gnu.org
  2020-05-19 21:07 ` [Bug middle-end/53890] " msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-09  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-09 08:39:18 UTC ---
I'm pretty sure we have duplicates for this case.


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

* [Bug middle-end/53890] bogus array bounds warning
  2012-07-07 20:30 [Bug c/53890] New: bogus array bounds warning nathan at acm dot org
  2012-07-07 21:27 ` [Bug c/53890] " pinskia at gcc dot gnu.org
  2012-07-09  8:39 ` rguenth at gcc dot gnu.org
@ 2020-05-19 21:07 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-05-19 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.8.5
      Known to work|                            |5.5.0
             Blocks|                            |56456
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed by commit f101c4b47a98c98238bbf31a7ee79b1b2e4cce7b

Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jan 27 09:49:29 2015 +0000

    re PR tree-optimization/56273 (Bogus -Warray-bounds warning)

    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.

    From-SVN: r220157


Referenced Bugs:

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

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

end of thread, other threads:[~2020-05-19 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-07 20:30 [Bug c/53890] New: bogus array bounds warning nathan at acm dot org
2012-07-07 21:27 ` [Bug c/53890] " pinskia at gcc dot gnu.org
2012-07-09  8:39 ` rguenth at gcc dot gnu.org
2020-05-19 21:07 ` [Bug middle-end/53890] " msebor 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).