middle-end: Fix stalled swapped condition code value [PR115836]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / strtok-4.c
blob793c7fcb7f4049bd33d3536153b79335ed244583
1 /* { dg-additional-options "-Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */
3 #include "../../gcc.dg/analyzer/analyzer-decls.h"
5 extern char *strtok (char *str, const char *delim);
7 void test (void)
9 char buffer[] = { 'a', 'x', 'b', 'y', 'c', '\0' };
11 char *p1 = strtok (buffer, "x");
12 /* Should result in:
13 | buffer[] = { 'a', '\0', 'b', 'y', 'c', '\0' },
14 | ^ ^ ^
15 | | | |
16 | | | internal ptr
17 | p1 modified. */
19 char *p2 = strtok (NULL, "y"); /* note new delimiter. */
20 /* Should result in:
21 | buffer[] = { 'a', '\0', 'b', '\0', 'c', '\0' },
22 | ^ ^ ^
23 | | | |
24 | | | internal ptr
25 | p2 modified. */
27 char *p3 = strtok (NULL, "z"); /* again new delimiter. */
28 /* Should result in:
29 | buffer[] = { 'a', '\0', 'b', '\0', 'c', '\0' },
30 | ^ ^~
31 | | |
32 | | internal ptr
33 | p3. */
35 char *p4 = strtok (NULL, "z");
36 /* Should result in p4 == NULL, and:
37 | buffer[] = { 'a', '\0', 'b', '\0', 'c', '\0' },
38 | ^~
39 | |
40 | internal ptr. */
42 /* We don't yet model strtok closely enough to capture
43 these exact behaviors. */