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 RFC: Ensure TREE_TYPE (TYPE_MIN_VALUE (t)) == t


Richard Guenther wrote:
> On 4/28/07, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
>> > Well, VRP never actually does the type comparison that I wrote.  The
>> > real question is whether, given a NEGATE_EXPR applied to 'max', this
>> > test is flawed:
>> >
>> >     if (max != TYPE_MIN_VALUE (TREE_TYPE (max)))
>>
>> I wouldn't want to make that assumption.  Instead, I'd use something
>> like operand_equal_p so that slight differences in types will be ignored.
>> It's much more robust not to make such assumptions unless you absolutely
>> have to.  And there seem to be at least two cases where it's wrong:
>> variants and subtypes.
> 
> Yes, for this test I think !tree_int_cst_equal () is the correct thing
> to check.

Me too.  I think we should basically never make direct comparisons
(based on pointers) between types or constants; instead, use explicit
comparison functions.  Then, we can make the functions do quick pointer
comparisons if that's safe.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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