2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-21.c
blob34e84bd0af24a2dcb5e2ffa0be48244766b12896
1 /* PR69537, spurious warning because of a missed optimization. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fno-short-enums -Wuninitialized" } */
5 enum clnt_stat {
6 RPC_SUCCESS=0,
7 RPC_CANTENCODEARGS=1,
8 };
10 int do_ypcall_tr ();
12 static int
13 yp_master (char **outname)
15 // Replacing enum clnt_stat with int avoids the warning.
16 enum clnt_stat result;
17 result = do_ypcall_tr ();
18 if (result != 0)
19 return result;
20 *outname = __builtin_strdup ("foo");
21 return 0;
24 int
25 yp_update (void)
27 char *master;
28 int r;
29 if ((r = yp_master (&master)) != 0)
30 return r;
31 __builtin_free (master); /* { dg-bogus "uninitialized" } */
32 return 0;