Avoid expicit builtion list in tree-ssa-dce
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / pr103217-2.c
blob69ba6454e57e4b88f17bc7e1e5e6e9e79f9cfd80
1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
3 typedef __SIZE_TYPE__ size_t;
5 extern void *calloc (size_t __nmemb, size_t __size)
6 __attribute__ ((__nothrow__ , __leaf__, __malloc__, __alloc_size__ (1, 2)));
8 extern char *strdup (const char *__s)
9 __attribute__ ((__nothrow__ , __leaf__, __malloc__, __nonnull__ (1)));
11 extern void abort (void)
12 __attribute__ ((__nothrow__ , __leaf__, __noreturn__));
14 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
15 __attribute__ ((__nothrow__ , __leaf__, __nonnull__ (2, 3)));
16 extern char *optarg;
18 extern void free (void *__ptr)
19 __attribute__ ((__nothrow__ , __leaf__));
21 char *xstrdup(const char *src) {
22 char *val = strdup(src);
23 if (!val)
24 abort();
25 return val;
28 struct test {
29 char *one, *two;
32 int main(int argc, char *argv[]) {
33 struct test *options = (struct test *) calloc(1, sizeof(*options));
34 int rc;
35 if (!options)
36 abort();
38 while ((rc = getopt(argc, argv, "a:b:")) != -1) {
39 switch (rc) {
40 case 'a':
41 free(options->one);
42 options->one = xstrdup(optarg);
43 break;
44 case 'b':
45 free(options->two);
46 options->two = xstrdup(optarg);
47 break;
50 free(options->one);
51 free(options->two);
52 free(options);
53 return 0;