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: [PATCH] Fix ICE on conversion within initializer


On Wed, Sep 17, 2008 at 1:44 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> --- 4205,4226 ----
>>         return op0;
>>         }
>>
>>       case NON_LVALUE_EXPR:
>>         return initializer_constant_valid_p (TREE_OPERAND (value, 0),
>> endtype);
>>
>> +     case VIEW_CONVERT_EXPR:
>> +       {
>> +       enum machine_mode src_mode = TYPE_MODE (TREE_TYPE
>> (TREE_OPERAND (value, 0)));
>> +       enum machine_mode end_mode = TYPE_MODE (endtype);
>> +       if (src_mode != BLKmode
>> +           && src_mode != VOIDmode
>> +           && end_mode != BLKmode
>> +           && end_mode != VOID_mode
>> +           && GET_MODE_SIZE (src_mode) == GET_MODE_SIZE (end_mode))
>> +         return initializer_constant_valid_p (TREE_OPERAND (value,
>> 0), endtype);
>> +       break;
>> +       }
>
> This will impair the Ada compiler, view-conversions between aggregate types
> need to be accepted.

Yes, but are they valid in this context and do they work for initializers?

> I think that the patch should be minimal and only deal
> with the problematic case (aggregate -> integral).

Well, to me the broad accepting of VIEW_CONVERT_EXPRs looks
bogus ;)

>>       CASE_CONVERT:
>>         {
>>         tree src;
>>
>> ?  Using the TYPE_PRECISION doesn't make too much sense to me
>> in the backend world.
>
> I can replace TYPE_PRECISION with GET_MODE_SIZE (TYPE_MODE) in my patch.

Another thing I'm confused on is the endtype (isn't documented unfortunately)
vs. dest_type distinction - what are these exactly for the case you are
running into?  Especially you seem to not allow pointer-types instead
of integral types - on purpose?

But using the mode size instead of TYPE_PRECISION would make
more sense, yes.  Which would with your patch be equivalent to
TYPE_MODE (endtype) == TYPE_MODE (dest_type), which would
be even more clear.

Richard.

> --
> Eric Botcazou
>


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