https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103658
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Note that with -fno-analyzer-state-merge, -fanalyzer warns without optimization
and shows the conditionals you hoped to see:
./xgcc -B. -S -fanalyzer /tmp/foo.c -fno-analyzer-state-merge
/tmp/foo.c: In function 'f':
/tmp/foo.c:9:11: warning: use of uninitialized value 'a[<unknown>]' [CWE-457]
[-Wanalyzer-use-of-uninitialized-value]
9 | return a[i + j];
| ~^~~~~~~
'f': events 1-6
|
| 3 | int a[3];
| | ^
| | |
| | (1) region created on stack here
|......
| 7 | if (i < 1) i = 1;
| | ~ ~~~~~
| | | |
| | | (3) ...to here
| | (2) following 'true' branch (when 'i <= 0')...
| 8 | if (j < 1) j = 1;
| | ~ ~~~~~
| | | |
| | | (5) ...to here
| | (4) following 'true' branch (when 'j <= 0')...
| 9 | return a[i + j];
| | ~~~~~~~~
| | |
| | (6) use of uninitialized value 'a[<unknown>]' here
|
Not sure why it's printing <unknown> for the index though.