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] PR 84740 Wrong string length type in bounds check


On Wed, Jan 10, 2018 at 01:18:46PM +0200, Janne Blomqvist wrote:

Thanks for fixing this PR.

> @@ -1562,7 +1562,8 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
>  	  if (first_len)
>  	    {
>  	      gfc_add_modify (&se->pre, first_len_val,
> -				   se->string_length);
> +			      fold_convert (TREE_TYPE (first_len_val),
> +						       se->string_length));

Wrong formatting, se->string_length should have been below TREE_TYPE.

>  	      first_len = false;
>  	    }
>  	  else
> @@ -1571,7 +1572,9 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
>  		 length.  */
>  	      tree cond = fold_build2_loc (input_location, NE_EXPR,
>  					   logical_type_node, first_len_val,
> -					   se->string_length);
> +					   fold_convert (TREE_TYPE
> +							 (first_len_val),
> +							 se->string_length));

And here, it might have been better to add a temporary for
TREE_TYPE (first_len_val)
to avoid the excessive line wrapping.

	Jakub


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