[PING] Re: [PATCH] c++/67913, 67917 - fix new expression with wrong number of elements

Martin Sebor msebor@gmail.com
Thu Nov 5 19:30:00 GMT 2015

On 11/02/2015 09:55 PM, Jason Merrill wrote:
> On 10/26/2015 10:06 PM, Martin Sebor wrote:
>> +      if (TREE_CONSTANT (maybe_constant_value (outer_nelts)))
>> +    {
>> +      if (tree_int_cst_lt (max_outer_nelts_tree, outer_nelts))
> maybe_constant_value may return a constant, but that doesn't mean that
> outer_nelts was already constant; if it wasn't, the call to
> tree_int_cst_lt will fail.

Thanks for the hint. I wasn't able to trigger the failure. I suspect
outer_nelts must have already been folded at this point because the
maybe_constant_value call isn't necessary. I removed it.

> Since we're moving toward delayed folding, I'd prefer to use the result
> of maybe_constant_value only for this diagnostic, and then continue to
> pass the unfolded value along.

Sure. Done in the attached patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-67913-67917-array-new-wrong-number-of-elements.patch
Type: text/x-patch
Size: 44919 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151105/04fb2104/attachment.bin>

More information about the Gcc-patches mailing list