This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix unnecessary -Wmaybe-uninitialized false positive (PR target/65313)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Feb 2016 23:29:26 +0100
- Subject: [PATCH] Fix unnecessary -Wmaybe-uninitialized false positive (PR target/65313)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
During profiledbootstrap on ppc64 I've noticed a -Wmaybe-uninitialized
warning in vect_schedule_slp_instance, when built with -fprofile-generate.
While it is clearly a false positive, IMHO it is completely unnecessary
to use here two variables, one uninitialized, another bool whether
it is initialized. In valid code gimple_assign_rhs_code should not
return ERROR_MARK, so we can use ocode == ERROR_MARK for the allsame
case and ocode != ERROR_MARK for !allsame.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2016-02-10 Jakub Jelinek <jakub@redhat.com>
PR target/65313
* tree-vect-slp.c (vect_schedule_slp_instance): Avoid
-Wmaybe-uninitialized warning.
--- gcc/tree-vect-slp.c.jj 2016-01-21 13:54:19.000000000 +0100
+++ gcc/tree-vect-slp.c 2016-02-09 13:40:30.280769470 +0100
@@ -3568,20 +3568,18 @@ vect_schedule_slp_instance (slp_tree nod
if (SLP_TREE_TWO_OPERATORS (node))
{
enum tree_code code0 = gimple_assign_rhs_code (stmt);
- enum tree_code ocode;
+ enum tree_code ocode = ERROR_MARK;
gimple *ostmt;
unsigned char *mask = XALLOCAVEC (unsigned char, group_size);
- bool allsame = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, ostmt)
if (gimple_assign_rhs_code (ostmt) != code0)
{
mask[i] = 1;
- allsame = false;
ocode = gimple_assign_rhs_code (ostmt);
}
else
mask[i] = 0;
- if (!allsame)
+ if (ocode != ERROR_MARK)
{
vec<gimple *> v0;
vec<gimple *> v1;
Jakub