middle-end: Fix stalled swapped condition code value [PR115836]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / pr103217.c
blobae298ccaebbefef77c4c9cdc676406ce2afe2277
1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
3 extern char *strdup (const char *__s)
4 __attribute__ ((__nothrow__ , __leaf__, __malloc__, __nonnull__ (1)));
6 extern void abort (void)
7 __attribute__ ((__nothrow__ , __leaf__, __noreturn__));
9 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
10 __attribute__ ((__nothrow__ , __leaf__, __nonnull__ (2, 3)));
11 extern char *optarg;
13 extern void free (void *__ptr)
14 __attribute__ ((__nothrow__ , __leaf__));
16 #include "../../gcc.dg/analyzer/analyzer-decls.h"
18 char *xstrdup(const char *src) {
19 char *val = strdup(src);
20 if (!val)
21 abort();
22 return val;
25 int main(int argc, char *argv[]) {
26 char *one = NULL, *two = NULL;
27 int rc;
29 while ((rc = getopt(argc, argv, "a:b:")) != -1) {
30 switch (rc) {
31 case 'a':
32 free(one);
33 one = xstrdup(optarg);
34 break;
35 case 'b':
36 free(two);
37 two = xstrdup(optarg);
38 break;
41 free(one);
42 free(two);
43 return 0;