Avoid expicit builtion list in tree-ssa-dce
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / write-to-string-literal-5.c
bloba949f15323d349e4c123192abd35d33ef0a7fc7b
1 /* Verify that deduplication of -Wanalyzer-write-to-string-literal (and their
2 notes) works. */
4 /* { dg-additional-options "-fanalyzer-show-duplicate-count" } */
5 /* { dg-require-effective-target alloca } */
7 #include "../../gcc.dg/analyzer/analyzer-decls.h"
9 typedef __SIZE_TYPE__ size_t;
11 int getrandom (void *__buffer, size_t __length,
12 /* { dg-message "parameter 1 of 'getrandom' marked with attribute 'access \\(write_only, 1, 2\\)'" "" { target c } .-1 } */
13 /* { dg-message "parameter 1 of 'int getrandom\\(void\\*, size_t, unsigned int\\)' marked with attribute 'access \\(write_only, 1, 2\\)'" "" { target c++ } .-2 } */
14 unsigned int __flags)
15 __attribute__ ((access (__write_only__, 1, 2)));
17 #define GRND_RANDOM 0x02
19 void *test (int flag)
21 char *ptr;
22 if (flag)
23 ptr = (char *) __builtin_malloc (1024);
24 else
25 ptr = (char *) __builtin_alloca (1024);
27 __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */
29 if (getrandom((char *)"foo", 3, GRND_RANDOM)) /* { dg-warning "write to string literal" "warning" } */
30 /* { dg-message "1 duplicate" "dup" { target *-*-* } .-1 } */
31 __builtin_printf("ok\n");
33 return ptr;