This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c/12245 III (expensive computation of array size)
- From: Ian Lance Taylor <iant at google dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Mon, 02 Mar 2009 15:28:55 -0800
- Subject: Re: PR c/12245 III (expensive computation of array size)
- References: <20090223154206.GB3614@kam.mff.cuni.cz>
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