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] for PR 18040


On Tue, 19 Oct 2004 18:18:24 -0400, Daniel Berlin <dberlin@dberlin.org> wrote:

> On Oct 19, 2004, at 5:35 PM, Richard Henderson wrote:
>
>> On Sun, Oct 17, 2004 at 02:04:13PM -0700, Zack Weinberg wrote:
>>> What he's saying is that
>>>
>>>    <COMPONENT_REF type struct field>
>>>
>>> (and all other reference nodes) would implicitly convert FIELD to TYPE,
>>> if that's not FIELD's intrinsic type.  I think this makes a hell of a
>>> lot of sense, personally.
>>
>> I think this is an exceptionally bad idea.
>>
> Is this because you'd rather force the optimizers to deal with the fact
> that there is a cast there, than only care if they want to?
>
> Or something else?

I think rth expects a COMPONENT_REF to always have the same type as the
field.  This seems like a good invariant, though it's not always the case
for bitfields (canonicalize_component_ref).

> And if it's the first solution, than I would assume your preferred solution
> to this problem is to make
> ((cast)var).field gimple, and audit the optimizers to make sure they aren't
> going to silently generate bad code in this case?

I think that's going to be necessary; adjusting the type of a COMPONENT_REF
won't handle the case you mention, since the VIEW_CONVERT_EXPR is wrapping
a VAR_DECL, not a COMPONENT_REF.

But we should only allow VIEW_CONVERT_EXPR, not NOP_EXPR or any other
conversion codes.

Jason


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