https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93355
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Current status is that there is testcase coverage for this in git, but the test
requires:
/* { dg-additional-options "-Wno-analyzer-too-complex
-fno-analyzer-feasibility" } */
(a) It happens to successfully explore enough of the graph to find the leak,
but hits complexity limits at 1 program point:
pr93355-localealias.c:263:41: warning: terminating analysis for this program
point: callstring: [(SN: 66 -> SN: 85 in _nl_expand_alias)] before (SN: 21
stmt: 0): _7 = *cp_107;EN: 163, EN: 170, EN: 177, EN: 370, EN: 557, EN: 794,
EN: 801, EN: 808 [-Wanalyzer-too-complex]
263 | while (isspace ((unsigned char) cp[0]))
| ~~^~~
(b) Without -fno-analyzer-feasibility, it falsely rejects the path as
infeasible at the "locale_alias_path[0] != '\0'" within _nl_expand_alias:
| 185 | added = 0;
| | ~~~~~~~~~
| | |
| | (3) ...to here
| 186 | while (added == 0 && locale_alias_path[0] != '\0')
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (5) ...to here
| | (4) following ‘true’ branch (when ‘added
== 0’)...
| | (6) following ‘true’ branch...
|
‘_nl_expand_alias’: event 7
|
|cc1:
| (7): ...to here
|
‘_nl_expand_alias’: events 8-9
|
| 198 | if (start < locale_alias_path)
| | ~~~~~~^~~~~~~~~~~~~~~~~~~
| | |
| | (8) this path would have been rejected as
infeasible at this edge: edge from EN: 88 to EN: 90; rejected constraint:
INIT_VAL((*INIT_VAL(locale_alias_path))) == (const char)0;
where region: {start_39, value: INIT_VAL(locale_alias_path)}
which looks like an instance of PR 96374.
(c) Also, the path it reports for the leak is rather verbose: it reports
various events in _nl_expand_alias leading to the call into read_alias_file,
but it really ought to just report the events in read_alias_file.
diagnostic_manager ought to prune leading interprocedural events (I think I had
code for this in one of my working copies)