https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109014
Bug ID: 109014 Summary: -Wanalyzer-use-of-uninitialized-value seen in pcre2-10.42's pcre2test.c Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Created attachment 54579 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54579&action=edit Partially reducer reproducer I'm about to commit a patch that provides a prototype implementation of sprintf; this leads to a new false positive on the attached: pcre2test.c: In function 'format_list_item': pcre2test.c:4448:21: warning: use of uninitialized value '*ff_44(D) + _2' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 4448 | for (count = 0; ff[count] >= 0; count++) { | ~~^~~~~~~ 'main': events 1-12 | | 4565 | main(int argc, char** argv) | | ^~~~ | | | | | (1) entry to 'main' |...... | 4579 | while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0) { | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) following 'true' branch... | | (8) following 'true' branch... | 4580 | /* [...snip...] */ | 4581 | char* arg = argv[op]; | | ~ | | | | | (3) ...to here | | (9) ...to here |...... | 4585 | if (strcmp(arg, "-LP") == 0) { | | ~ | | | | | (4) following 'false' branch (when the strings are non-equal)... | | (10) following 'true' branch (when the strings are equal)... | 4586 | display_properties(0); | | ~~~~~~~~~~~~~~~~~~~~~ | | | | | (11) ...to here | | (12) calling 'display_properties' from 'main' |...... | 4592 | if (strcmp(arg, "-8") == 0) { | | ~~~~~~~~~~~~~~~~~~ | | || | | |(5) ...to here | | (6) following 'true' branch (when the strings are equal)... | 4593 | test_mode = 8; | | ~~~~~~~~~~~~~ | | | | | (7) ...to here | +--> 'display_properties': events 13-25 | | 4481 | display_properties(BOOL wantscripts) | | ^~~~~~~~~~~~~~~~~~ | | | | | (13) entry to 'display_properties' |...... | 4487 | int16_t found[256][5 + 1]; | | ~~~~~ | | | | | (14) region created on stack here |...... | 4492 | if (wantscripts) { | | ~ | | | | | (15) following 'false' branch (when 'wantscripts == 0')... |...... | 4496 | n = ucp_Bprop_Count; | | ~~~~~~~~~~~~~~~~~~~ | | | | | (16) ...to here |...... | 4500 | for (size_t i = 0; i < utt_size; i++) { | | ~~~~~~~~~~~~ | | | | | (17) following 'true' branch... | 4501 | int k; | 4502 | int m = 0; | | ~ | | | | | (18) ...to here |...... | 4507 | if (wantscripts) { | | ~ | | | | | (19) following 'false' branch (when 'wantscripts == 0')... |...... | 4511 | if (t->type != 13) | | ~~~~~~~~ | | | | | | | (20) ...to here | | (21) following 'true' branch... | | (22) ...to here |...... | 4544 | for (int k = 0; k < (n + 1) / 2; k++) { | | ~~~~~~~~~~~~~~~ | | | | | (23) following 'true' branch... |...... | 4549 | format_list_item(found[k], buff1, wantscripts); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (24) ...to here | | (25) calling 'format_list_item' from 'display_properties' | +--> 'format_list_item': events 26-27 | | 4441 | format_list_item(int16_t* ff, char* buff, BOOL isscript) | | ^~~~~~~~~~~~~~~~ | | | | | (26) entry to 'format_list_item' |...... | 4448 | for (count = 0; ff[count] >= 0; count++) { | | ~~~~~~~~~ | | | | | (27) use of uninitialized value '*ff_44(D) + _2' here |