build_x_binary_op (ARRAY_REF ?!
Alexey Starovoytov
Alexey.Starovoytov@Sun.COM
Thu Apr 20 02:03:00 GMT 2006
On Wed, 19 Apr 2006, Daniel Berlin wrote:
>
> On Apr 19, 2006, at 4:48 PM, Alexey Starovoytov wrote:
>
>> Hi,
>>
>> Is this a bug that we were lucky not to hit?
>>
>> cp/pt.c:
>> return build_x_binary_op (ARRAY_REF, op1, RECUR (TREE_OPERAND (t, 1)),
>> /*overloaded_p=*/NULL);
>> tree
>> build_x_binary_op (enum tree_code code, tree arg1, tree arg2,
>> bool *overloaded_p)
>> {
>> ...
>> return build_min_nt (code, arg1, arg2);
>> ...
>> return build_min_non_dep (code, expr, orig_arg1, orig_arg2);
>> }
>>
>> the 'code' for build_min* will still be ARRAY_REF, so both functions
>> have a chance to init ARRAY_REF with some junk:
>> for (i = 0; i < length; i++)
>> {
>> tree x = va_arg (p, tree);
>> TREE_OPERAND (t, i) = x;
>> }
>
> The returned memory is memset in make_node in tree.c or thereabouts.
> IIRC.
make_node does memset, but the loop above is after the call to make_node.
I guess we didn't hit the problem just because tsubst_copy_and_build()
(where build_x_binary_op (ARRAY_REF is) is never called for array_ref
when processing_template_decl is non zero.
I guess that sort of assertions need at least a comment or gcc_assert().
Alex.
More information about the Gcc
mailing list