Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c

raw
1 /* Verify that we can disable warnings that have notes added to them via
2 region_model_context_decorator::add_note. */
3
4 /* { dg-additional-options "-Wno-analyzer-write-to-string-literal" } */
5
6 typedef __SIZE_TYPE__ size_t;
7
8 int getrandom (void *__buffer, size_t __length, /* { dg-bogus "parameter 1 of 'getrandom' marked with attribute 'access \\(write_only, 1, 2\\)'" } */
9 unsigned int __flags)
10 __attribute__ ((access (__write_only__, 1, 2)));
11
12 #define GRND_RANDOM 0x02
13
14 void test (int flag)
15 {
16 char *buf;
17
18 if (flag)
19 buf = (char *) __builtin_malloc (1024);
20 else
21 buf = (char *)""; /* { dg-bogus "here" } */
22
23 if (getrandom(buf, 16, GRND_RANDOM)) /* { dg-bogus "write to string literal" } */
24 __builtin_printf("%s\n", buf);
25
26 if (flag)
27 __builtin_free (buf);
28 }