public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/109190] New: GCC Static Analyzer cannot handle the initialization of an array with a for loop
@ 2023-03-19  8:57 geoffreydgr at icloud dot com
  2023-04-03 12:59 ` [Bug analyzer/109190] " geoffreydgr at icloud dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: geoffreydgr at icloud dot com @ 2023-03-19  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109190
           Summary: GCC Static Analyzer cannot handle the initialization
                    of an array with a for loop
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: geoffreydgr at icloud dot com
  Target Milestone: ---

I got a false negative error when compiling the following program with
gcc(trunk) -fanalyzer -O0 in https://godbolt.org/z/KvoxvPq5c. When I replace
the array `m` with the variable `a` (https://godbolt.org/z/jTzo9bEo9), the NPD
appears.

```c
#include "stdio.h"
int main() {
    int i = 0;
    int *g = &i;
    int m[1];

    for (int j = 0; j < 1; j++) {
         m[j] = 0;
    }

    if (m[0])
        ;
    else
        g = m[i];

    printf("NPD_FLAG\n");
    *g = 1;
}
```

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

end of thread, other threads:[~2023-04-10 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19  8:57 [Bug analyzer/109190] New: GCC Static Analyzer cannot handle the initialization of an array with a for loop geoffreydgr at icloud dot com
2023-04-03 12:59 ` [Bug analyzer/109190] " geoffreydgr at icloud dot com
2023-04-03 13:39 ` xry111 at gcc dot gnu.org
2023-04-08 14:44 ` geoffreydgr at icloud dot com
2023-04-10 20:18 ` StevenSun2021 at hotmail dot com

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).