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: [applied] C++ patch to fix arrays of vectors


On 04 Jun 2003 18:21:05 -0700, Mark Mitchell <mark@codesourcery.com> wrote:

>> *************** reshape_init (tree type, tree *initp)
>> *** 7483,7490 ****
>>         non-empty subaggregate, brace elision is assumed and the
>>         initializer is considered for the initialization of the first
>>         member of the subaggregate.  */
>> !   if (CLASS_TYPE_P (type)
>> !       && !brace_enclosed_p
>>          && can_convert_arg (type, TREE_TYPE (old_init_value), 
>> old_init_value))
>>        {
>>          *initp = TREE_CHAIN (old_init);
>> --- 7484,7490 ----
>>         non-empty subaggregate, brace elision is assumed and the
>>         initializer is considered for the initialization of the first
>>         member of the subaggregate.  */
>> !   if (!brace_enclosed_p
>>          && can_convert_arg (type, TREE_TYPE (old_init_value), 
>> old_init_value))
>>        {
>>          *initp = TREE_CHAIN (old_init);
>
> This hunk is potentially dangerous and definitely suboptimal.
>
> Please revise this to check for 
>
>   CLASS_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE
>
> We shouldn't be going into that code for an array type.

What about a compound literal of array type (is there such a thing)?  If
the CONSTRUCTOR has the right type, we've already massaged it
appropriately.  Though I suppose can_convert_arg would never return true,
as it does array-to-pointer conversion on the arg before checking for type
identity.

Jason


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