Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/pr95000-1.c

raw
1 #include "analyzer-decls.h"
2
3 void test_1 (char* x)
4 {
5 char* y=0;
6 switch (*x) {
7 case 'a': /* { dg-message "to here" } */
8 y="foo";
9 case 'b':
10 if (*x=='a') *y='b'; /* { dg-bogus "dereference of NULL 'y'" "deref of null (PR analyzer/95000)" { xfail *-*-* } } */
11 /* { dg-warning "write to string literal" "write to string literal" { target *-*-* } .-1 } */
12 }
13 }
14
15 void test_switch_char(char x) {
16 switch (x) {
17 case 'b':
18 __analyzer_eval (x == 'b'); /* { dg-warning "TRUE" "expected" { xfail *-*-* } } */
19 /* { dg-bogus "UNKNOWN" "status quo (PR analyzer/95000)" { xfail *-*-* } .-1 } */
20 }
21 }
22
23 void test_switch_int(int x) {
24 switch (x) {
25 case 97:
26 __analyzer_eval (x == 97); /* { dg-warning "TRUE" } */
27 }
28 }
29
30 void test_if_char(char x) {
31 if (x == 'b')
32 __analyzer_eval (x == 'b'); /* { dg-warning "TRUE" } */
33 }
34
35 void test_if_int(int x) {
36 if (x == 97)
37 __analyzer_eval (x == 97); /* { dg-warning "TRUE" } */
38 }