public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/114914] New: False positive with -Wanalyzer-out-of-bounds
@ 2024-05-01 21:55 udo at hypervisor dot org
  0 siblings, 0 replies; only message in thread
From: udo at hypervisor dot org @ 2024-05-01 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114914
           Summary: False positive with -Wanalyzer-out-of-bounds
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: udo at hypervisor dot org
  Target Milestone: ---

Created attachment 58079
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58079&action=edit
Test case

For the attached test case, the analyzer incorrectly flags an array overflow as
follows: test.c:7:9: note: valid subscripts for ‘c’ are ‘[0]’ to ‘[1]’

The analyzer doesn't grok that v is in range 253...254 in the else-branch of
x() and therefore n is in range 0...1 when f() is called.

Reproducer: https://godbolt.org/z/fnxxns13x

The false positive occurs with gcc-14.1.0-RC-20240430.
The latest release (gcc-13.2) sees nothing wrong with this code.
I would therefore consider this a regression.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-01 21:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 21:55 [Bug analyzer/114914] New: False positive with -Wanalyzer-out-of-bounds udo at hypervisor dot 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).