view gcc/testsuite/gcc.dg/uninit-21.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR69537, spurious warning because of a missed optimization. */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-short-enums -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;
}