diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/uninit-21.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/uninit-21.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-21.c b/gcc/testsuite/gcc.dg/uninit-21.c new file mode 100644 index 00000000000..68e2c6dbe50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-21.c @@ -0,0 +1,33 @@ +/* PR69537, spurious warning because of a missed optimization. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +enum clnt_stat { + RPC_SUCCESS=0, + RPC_CANTENCODEARGS=1, +}; + +int do_ypcall_tr (); + +static int +yp_master (char **outname) +{ + // Replacing enum clnt_stat with int avoids the warning. + enum clnt_stat result; + result = do_ypcall_tr (); + if (result != 0) + return result; + *outname = __builtin_strdup ("foo"); + return 0; +} + +int +yp_update (void) +{ + char *master; + int r; + if ((r = yp_master (&master)) != 0) + return r; + __builtin_free (master); /* { dg-bogus "uninitialized" } */ + return 0; +} |