diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbdc5f7b92f..48c16d15af0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-01-29 Richard Biener + + PR middle-end/69537 + * match.pd: Allow all integral types when simplifying a + widening or sign-changing conversion. + 2016-01-28 Sebastian Pop * graphite-isl-ast-to-gimple.c (get_rename_from_scev): Revert assert diff --git a/gcc/match.pd b/gcc/match.pd index 5f282157012..63134114bdb 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2121,7 +2121,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for cmp (simple_comparison) (simplify (cmp (convert@0 @00) (convert?@1 @10)) - (if (TREE_CODE (TREE_TYPE (@0)) == INTEGER_TYPE + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) /* Disable this optimization if we're casting a function pointer type on targets that require function pointer canonicalization. */ && !(targetm.have_canonicalize_funcptr_for_compare () diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d8810beffe1..3c271847f7c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-29 Richard Biener + + PR middle-end/69537 + * gcc.dg/uninit-21.c: New testcase. + 2016-01-28 Uros Bizjak PR target/69459 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; +}