This is the mail archive of the 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 PR optimization/11210

On Sat, 2003-06-28 at 06:01, Eric Botcazou wrote:
> I got caught by expr.c:get_inner_reference(), which is advertised as handling 
> NOP_EXPR and the likes, but doesn't return the value you would have expected 
> for NOP_EXPRs wrapping up bitfields.

I don't think there is any problem get get_inner_reference.  I think the
problem is with the way that decode_field_reference uses it.  Note the
inner == exp test after the call.  We don't bother to check to see if
exp is a valid argument for get_inner_reference before the call. 
Instead, we check to see if get_inner_reference did anything to it, and
if so, we assume it must have been a valid argument.  This fails if we
don't strip off NOP_EXPRs that change the sign.  In that case,
get_inner_reference strips off the NOP_EXPR, and returns something
different than the argument, and decode_field_reference assumes we have
an actual innermost reference, but we don't.  So we need to strip all
NOP_EXPRs, and remember the outermost type so we can set the punsignedp
correctly ourselves after the call.

Since neither decode_field_reference nor get_inner_reference change the
size of the operand, we don't have to check if the size is the same.

There was another place that set exp and called STRIP_NOPS.  We need to
set outer_type there also.

This gives me the following patch.  It works for the s390 testcase, and
for the original testcase.  I haven't tried any other testing.


Attachment: tmp.file.246
Description: Text document

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