Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-2.c

raw
1 /* Simplified version of test to ensure we issue a FILE * leak diagnostic,
2 reproducing a feasibility issue.
3 Adapted from intl/localealias.c, with all #includes removed. */
4
5 /* { dg-do "compile" } */
6
7 #include "analyzer-decls.h"
8
9 #define PATH_SEPARATOR ':'
10 #define LOCALE_ALIAS_PATH "value for LOCALE_ALIAS_PATH"
11
12 const char *
13 _nl_expand_alias (void)
14 {
15 static const char *locale_alias_path;
16
17 if (locale_alias_path == NULL)
18 locale_alias_path = LOCALE_ALIAS_PATH;
19
20 const char *start = locale_alias_path;
21
22 while (locale_alias_path[0] != '\0'
23 && locale_alias_path[0] != PATH_SEPARATOR)
24 ++locale_alias_path;
25
26 if (start < locale_alias_path)
27 __analyzer_dump_path (); /* { dg-message "path" } */
28 }