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: PR c/12245 III (expensive computation of array size)


Jan Hubicka <hubicka@ucw.cz> writes:

> 	PR c/12245
> 	* c-common.c (complete_array_type): Convert into sizetype only the
> 	maximal elemnt, not all temporary indexes.


> --- 7752,7771 ----
>   		   VEC_iterate (constructor_elt, v, cnt, ce);
>   		   cnt++)
>   		{
> + 		  bool curfold_p = false;
>   		  if (ce->index)
> ! 		    curindex = ce->index, curfold_p = true;
>   		  else
> ! 		    {
> ! 		      if (fold_p)
> ! 		        curindex = fold_convert (sizetype, curindex);
> ! 		      curindex = size_binop (PLUS_EXPR, curindex, size_one_node);
> ! 		    }
>   		  if (tree_int_cst_lt (maxindex, curindex))
> ! 		    maxindex = curindex, fold_p = curfold_p;
>   		}
> + 	       if (fold_p)
> + 	         maxindex = fold_convert (sizetype, maxindex);

Please use curly braces and two separate lines rather than hiding two
assigments via the comma operator.

OK with that change.

Thanks.

Ian


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