re PR middle-end/69537 (Incorrect -Wmaybe-uninitialized warning with enum variable)

2016-01-29  Richard Biener  <rguenther@suse.de>

	PR middle-end/69537
	* match.pd: Allow all integral types when simplifying a
	widening or sign-changing conversion.

	* gcc.dg/uninit-21.c: New testcase.

From-SVN: r232968
This commit is contained in:
Richard Biener 2016-01-29 08:36:04 +00:00 committed by Richard Biener
parent 8dffffd00c
commit 452ec2a5ec
4 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-01-29 Richard Biener <rguenther@suse.de>
PR middle-end/69537
* match.pd: Allow all integral types when simplifying a
widening or sign-changing conversion.
2016-01-28 Sebastian Pop <s.pop@samsung.com>
* graphite-isl-ast-to-gimple.c (get_rename_from_scev): Revert assert

View File

@ -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 ()

View File

@ -1,3 +1,8 @@
2016-01-29 Richard Biener <rguenther@suse.de>
PR middle-end/69537
* gcc.dg/uninit-21.c: New testcase.
2016-01-28 Uros Bizjak <ubizjak@gmail.com>
PR target/69459

View File

@ -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;
}