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

--- Comment #3 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
'-Wall' and '-fanalyzer':

    [...]/c-c++-common/cpp/embed-1.c:191:14: warning: missing braces around
initializer [-Wmissing-braces]
      191 | struct V v = {
          |              ^
      192 | #embed "magna-carta.txt"
__limit__(4)__prefix__(42,)__suffix__(,-42)
          |        {{}}
    [...]/c-c++-common/cpp/embed-1.c: In function ‘main’:
    [...]/c-c++-common/cpp/embed-1.c:255:8: warning: left-hand operand of comma
expression has no effect [-Wunused-value]
      255 | #embed "magna-carta.txt" limit (4) prefix (172 + ) suffix (+ 2)
          |        ^~~~~~~~~~~~~~~~~
    [...]/c-c++-common/cpp/embed-1.c:255:8: warning: left-hand operand of comma
expression has no effect [-Wunused-value]
    [...]/c-c++-common/cpp/embed-1.c:255:8: warning: left-hand operand of comma
expression has no effect [-Wunused-value]
    [...]/c-c++-common/cpp/embed-1.c:319:52: warning: use of uninitialized
value ‘meow_bytes[<unknown>]’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
      319 |     meow[i] = (meow_bytes[i * 2] << 8) | meow_bytes[i * 2 + 1];
          |                                          ~~~~~~~~~~^~~~~~~~~~~
      ‘main’: events 1-5
        │
        │  237 | main ()
        │      | ^~~~
        │      | |
        │      | (1) entry to ‘main’
        │  238 | {
        │  239 |   if (a != '/' || b != 42 || c != 0)
        │      |      ~
        │      |      |
        │      |      (3) following ‘false’ branch... ─>─┐
        │      |                                         │
        │......
        │      |                                         │
        │      |┌────────────────────────────────────────┘
        │  245 |│  if (!strstr ((const char *) magna_carta, "imprisonétur"))
        │      |│       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |│       |
        │      |└──────>(4) ...to here
        │      |        (5) when ‘strstr’ returns non-NULL
        │......
        │  314 |   const unsigned char meow_bytes[] = {
        │      |                       ~~~~~~~~~~
        │      |                       |
        │      |                       (2) region created on stack here
        │
      ‘main’: events 6-8
        │
        │  245 |   if (!strstr ((const char *) magna_carta, "imprisonétur"))
        │      |      ^
        │      |      |
        │      |      (6) following ‘false’ branch... ─>─┐
        │      |                                         │
        │      |                                         │
        │      |┌────────────────────────────────────────┘
        │  246 |│    abort ();
        │  247 |│  if (sizeof (d) != 3 + 15 + 1
        │      |│     ~
        │      |│     |
        │      |│     (8) following ‘false’ branch... ─>─┐
        │      |│                                        │
        │      |│                                        │
        │      |┌────────────────────────────────────────┘
        │  248 |│      || d[0] != 239 || d[1] != 187 || d[2] != 191 || d[3 +
15] != 0)
        │      |│         ~~~~
        │      |│          |
        │      |└─────────>(7) ...to here
        │
      ‘main’: event 9
        │
        │  248 |       || d[0] != 239 || d[1] != 187 || d[2] != 191 || d[3 +
15] != 0)
        │      |                         ~^~~
        │      |                          |
        │      |└────────────────────────>(9) ...to here
        │
      ‘main’: events 10-11
        │
        │  247 |   if (sizeof (d) != 3 + 15 + 1
        │      |       ~~~~~~~~~~~~~~~~~~~~~~~~
        │  248 |       || d[0] != 239 || d[1] != 187 || d[2] != 191 || d[3 +
15] != 0)
        │      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
        │      |                      |
        │      |                      (10) following ‘false’ branch... ─>─┐
        │      |                                                          │
        │......
        │      |                                                          │
        │      |┌─────────────────────────────────────────────────────────┘
        │  251 |│  if (sizeof (e) != 42 || e[21] != 'X' || e[22] != 'X' ||
e[23] != 'X')
        │      |│                          ~~~~~
        │      |│                           |
        │      |└──────────────────────────>(11) ...to here
        │
      ‘main’: events 12-15
        │
        │  251 |   if (sizeof (e) != 42 || e[21] != 'X' || e[22] != 'X' ||
e[23] != 'X')
        │      |      ^
        │      |      |
        │      |      (12) following ‘false’ branch... ─>─┐
        │      |                                          │
        │......
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  254 |│  f = (
        │      |│  ~~~~~
        │      |│    |
        │      |└───>(13) ...to here
        │  255 | #embed "magna-carta.txt" limit (4) prefix (172 + ) suffix (+
2)
        │      |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  256 |   );
        │      |   ~   
        │  257 |   if (f != 'r' + 2)
        │      |      ~
        │      |      |
        │      |      (14) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  258 |│    abort ();
        │  259 |│  if (g.a != 'H' || g.b != 'e' || g.c != 'n' || g.d != 'r')
        │      |│      ~~~
        │      |│       |
        │      |└──────>(15) ...to here
        │
      ‘main’: events 16-18
        │
        │  259 |   if (g.a != 'H' || g.b != 'e' || g.c != 'n' || g.d != 'r')
        │      |      ^
        │      |      |
        │      |      (16) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  260 |│    abort ();
        │  261 |│  if (!strstr ((const char *) h, "imprisonétur")
        │      |│       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |│       |
        │      |└──────>(17) ...to here
        │      |        (18) when ‘strstr’ returns non-NULL
        │
      ‘main’: events 19-21
        │
        │  261 |   if (!strstr ((const char *) h, "imprisonétur")
        │      |      ^
        │      |      |
        │      |      (19) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  262 |│      || !strstr ((const char *) h, "blah blah"))
        │      |│          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |│          |
        │      |└─────────>(20) ...to here
        │      |           (21) when ‘strstr’ returns non-NULL
        │
      ‘main’: events 22-23
        │
        │  261 |   if (!strstr ((const char *) h, "imprisonétur")
        │      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  262 |       || !strstr ((const char *) h, "blah blah"))
        │      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |       |
        │      |       (22) following ‘false’ branch... ─>─┐
        │      |                                           │
        │      |                                           │
        │      |┌──────────────────────────────────────────┘
        │  263 |│    abort ();
        │  264 |│  if (v.a != 42 || v.b.a != 'H' || v.b.b.a != 'e'
        │      |│      ~~~
        │      |│       |
        │      |└──────>(23) ...to here
        │
      ‘main’: events 24-25
        │
        │  264 |   if (v.a != 42 || v.b.a != 'H' || v.b.b.a != 'e'
        │      |      ^
        │      |      |
        │      |      (24) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  265 |│      || v.b.c != 'n' || v.c != 'r' || v.d != -42)
        │      |│         ~~~~~
        │      |│            |
        │      |└───────────>(25) ...to here
        │
      ‘main’: events 26-27
        │
        │  264 |   if (v.a != 42 || v.b.a != 'H' || v.b.b.a != 'e'
        │      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  265 |       || v.b.c != 'n' || v.c != 'r' || v.d != -42)
        │      |       ^~~~~~~~~~~~~~~
        │      |       |
        │      |       (26) following ‘false’ branch... ─>─┐
        │      |                                           │
        │......
        │      |                                           │
        │      |┌──────────────────────────────────────────┘
        │  268 |│  if (sizeof (w) != 1572 || w[0] != 42 || w[1] != 0 || w[71]
!= 0
        │      |│                            ~~~~
        │      |│                             |
        │      |└────────────────────────────>(27) ...to here
        │
      ‘main’: events 28-29
        │
        │  268 |   if (sizeof (w) != 1572 || w[0] != 42 || w[1] != 0 || w[71]
!= 0
        │      |      ^
        │      |      |
        │      |      (28) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  269 |│      || w[72] != 'H' || w[73] != 'e' || w[74] != 'n' || w[75]
!= 'r')
        │      |│         ~~~~~
        │      |│          |
        │      |└─────────>(29) ...to here
        │
      ‘main’: events 30-31
        │
        │  268 |   if (sizeof (w) != 1572 || w[0] != 42 || w[1] != 0 || w[71]
!= 0
        │      |      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  269 |       || w[72] != 'H' || w[73] != 'e' || w[74] != 'n' || w[75]
!= 'r')
        │      |       ^~~~~~~~~~~~~~~
        │      |       |
        │      |       (30) following ‘false’ branch... ─>─┐
        │      |                                           │
        │......
        │      |                                           │
        │      |┌──────────────────────────────────────────┘
        │  272 |│  if (sizeof (x) != 5 || x[0] != 0 || x[1] != 1 || x[2] != 2
        │      |│                         ~~~~
        │      |│                          |
        │      |└─────────────────────────>(31) ...to here
        │
      ‘main’: events 32-33
        │
        │  272 |   if (sizeof (x) != 5 || x[0] != 0 || x[1] != 1 || x[2] != 2
        │      |      ^
        │      |      |
        │      |      (32) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  273 |│      || x[3] != 3 || x[4] != 4)
        │      |│         ~~~~
        │      |│          |
        │      |└─────────>(33) ...to here
        │
      ‘main’: events 34-36
        │
        │  272 |   if (sizeof (x) != 5 || x[0] != 0 || x[1] != 1 || x[2] != 2
        │      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  273 |       || x[3] != 3 || x[4] != 4)
        │      |       ^~~~~~~~~~~~
        │      |       |
        │      |       (34) following ‘false’ branch... ─>─┐
        │      |                                           │
        │      |                                           │
        │      |┌──────────────────────────────────────────┘
        │  274 |│    abort ();
        │  275 |│  foo (
        │      |│  ~~~~~
        │      |│  |
        │      |└─>(35) ...to here
        │      |   (36) calling ‘foo’ from ‘main’
        │  276 | #embed <magna-carta.txt> limit(5)
        │      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  277 |   );
        │      |   ~    
        │
        └──> ‘foo’: events 37-39
               │
               │  230 | foo (unsigned int a, unsigned long long b, unsigned
char c, int d, int e)
               │      | ^~~
               │      | |
               │      | (37) entry to ‘foo’
               │  231 | {
               │  232 |   if (a != 'H' || b != 'e' || c != 'n' || d != 'r' ||
!e)
               │      |      ~
               │      |      |
               │      |      (38) following ‘false’ branch... ─>─┐
               │      |                                          │
               │      |                                          │
               │      |┌─────────────────────────────────────────┘
               │  233 |│    abort ();
               │  234 |│}
               │      |│~
               │      |│|
               │      |└(39) ...to here
               │
        <──────┘
        │
      ‘main’: events 40-44
        │
        │  275 |   foo (
        │      |   ^~~~~
        │      |   |
        │      |   (40) returning to ‘main’ from ‘foo’
        │  276 | #embed <magna-carta.txt> limit(5)
        │      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  277 |   );
        │      |   ~
        │......
        │  282 |   if (sizeof (z) < 100
        │      |      ~
        │      |      |
        │      |      (42) following ‘false’ branch... ─>─┐
        │      |                                          │
        │      |                                          │
        │      |┌─────────────────────────────────────────┘
        │  283 |│      || strstr ((const char *) z, "Dummy file.")
        │      |│         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |│         |
        │      |│         (41) when ‘strstr’ returns NULL
        │  284 |│      || !strstr ((const char *) z,
"__gnu__::__non_existent_parameter"))
        │      |│         
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |│          |
        │      |└─────────>(43) ...to here
        │      |           (44) when ‘strstr’ returns non-NULL
        │
      ‘main’: events 45-49
        │
        │  282 |   if (sizeof (z) < 100
        │      |       ~~~~~~~~~~~~~~~~
        │  283 |       || strstr ((const char *) z, "Dummy file.")
        │      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │  284 |       || !strstr ((const char *) z,
"__gnu__::__non_existent_parameter"))
        │      |      
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |       |
        │      |       (45) following ‘false’ branch... ─>─┐
        │      |                                           │
        │......
        │      |                                           │
        │      |┌──────────────────────────────────────────┘
        │  314 |│  const unsigned char meow_bytes[] = {
        │      |│                      ~~~~~~~~~~
        │      |│                      |
        │      |└─────────────────────>(46) ...to here
        │......
        │  318 |   for (int i = 0; i < (int) (sizeof (meow) / sizeof (short));
i++)
        │      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        │      |                     |
        │      |                     (47) following ‘true’ branch (when ‘i <=
134’)... ─>─┐
        │      |                                                               
          │
        │      |                                                               
          │
        │     
|┌─────────────────────────────────────────────────────────────────────────┘
        │  319 |│    meow[i] = (meow_bytes[i * 2] << 8) | meow_bytes[i * 2 +
1];
        │      |│                          ~~~~~          ~~~~~~~~~~~~~~~~~~~~~
        │      |│                            |                      |
        │      |└───────────────────────────>(48) ...to here        (49) ⚠️  use
of uninitialized value ‘meow_bytes[<unknown>]’ here
        │

Reply via email to