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] Avoid uninit warnings with PR79345 fix


On Tue, Feb 21, 2017 at 02:53:32PM +0100, Richard Biener wrote:
> 
> The following fixes a bit-load.c bug as well as avoids the warnings
> for two other cases.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Ok?
> 
> Thanks,
> Richard.
> 
> 2017-02-21  Richard Biener  <rguenther@suse.de>
> 
> 	* bt-load.c (compute_defs_uses_and_gen): Clear call_saved.
> 	* fixed-value.c (fixed_from_string): Use wi::ulow and wi::uhigh.
> 	(fixed_convert_from_real): Likewise.
> 	* ipa-cp.c (ipcp_store_vr_results): Do not uselessly initialize
> 	VR_VARYING min/max.
> 
> Index: gcc/bt-load.c
> ===================================================================
> --- gcc/bt-load.c	(revision 245620)
> +++ gcc/bt-load.c	(working copy)
> @@ -543,6 +543,7 @@ compute_defs_uses_and_gen (btr_heap_t *a
>  		      int i;
>  
>  		      /* Check for sibcall.  */
> +		      CLEAR_HARD_REG_SET (call_saved);
>  		      if (GET_CODE (pat) == PARALLEL)
>  			for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)
>  			  if (ANY_RETURN_P (XVECEXP (pat, 0, i)))

Why do we warn here?
                      HARD_REG_SET *clobbered = &call_used_reg_set;
                      HARD_REG_SET call_saved;
                      rtx pat = PATTERN (insn);
                      int i;

                      /* Check for sibcall.  */
                      if (GET_CODE (pat) == PARALLEL)
                        for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)
                          if (ANY_RETURN_P (XVECEXP (pat, 0, i)))
                            {
                              COMPL_HARD_REG_SET (call_saved,
                                                  call_used_reg_set);
                              clobbered = &call_saved;
                            }

                      for (regno = first_btr; regno <= last_btr; regno++)
                        if (TEST_HARD_REG_BIT (*clobbered, regno))
                          note_btr_set (regno_reg_rtx[regno], NULL_RTX, &info);
COMPL_HARD_REG_SET should always overwrite all of call_saved (it is
call_saved = ~call_used_reg_set).

> --- gcc/fixed-value.c	(revision 245620)
> +++ gcc/fixed-value.c	(working copy)
> @@ -130,8 +130,8 @@ fixed_from_string (FIXED_VALUE_TYPE *f,
>    real_arithmetic (&fixed_value, MULT_EXPR, &real_value, &base_value);
>    wide_int w = real_to_integer (&fixed_value, &fail,
>  				GET_MODE_PRECISION (mode));
> -  f->data.low = w.elt (0);
> -  f->data.high = w.elt (1);
> +  f->data.low = w.ulow ();
> +  f->data.high = w.uhigh ();

Is this for the case when the wide_int has only a single uhwi (or more than
two)?

> --- gcc/ipa-cp.c	(revision 245620)
> +++ gcc/ipa-cp.c	(working copy)
> @@ -4959,7 +4959,6 @@ ipcp_store_vr_results (void)
>  	    {
>  	      vr.known = false;
>  	      vr.type = VR_VARYING;
> -	      vr.min = vr.max = wi::zero (INT_TYPE_SIZE);
>  	    }
>  	  ts->m_vr->quick_push (vr);
>  	}

It is strange to see removing initialization of something as a work-around
to uninitialized warning.  Is that because of the vr.min = vr.max assignment
and that wi::zero doesn't initialize everything?

	Jakub


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