This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix unnecessary -Wmaybe-uninitialized false positive (PR target/65313)


On Wed, 10 Feb 2016, Jakub Jelinek wrote:

> 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?

Ok.

Thanks,
Richard.

> 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
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]