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: PR c++/5310 Weird warnings about using (int)NULL


On 16/11/2007, Nathan Sidwell <nathan@codesourcery.com> wrote:
> Manuel López-Ibáñez wrote:
> > :ADDPATCH c++:
> >
> > Following http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00583.html,
> > this is a proposed fix for PR 5310. It is a bit ugly but it is
> > straightforward. Suggestions on how to make it prettier are welcome.
> >
> > The problem was that same_type returns 1 when comparing null_ptr_cst
> > with any integer type and returns an identity conversion (which
> > actually is a conversion to the original type and not to the final
> > type). Then, convert_like_real sees the identity conversion and drops
> > the cast without touching the __null node.
> >
> > The fix stores the final type instead of the original type in the
> > identity conversion. Then, in convert_like_real, it forces a
> > conversion of the __null node to the new type.
>
> ok thanks.
>

Actually, I was expecting some comments on how to make the patch less
ugly. convert_like_real is ugly enough. Also, is build_nop(totype,
integer_zero_node) the correct way to build a zero of type 'totype' ?

But if it is ok with you as it is, I will just add some comments
clarifying the code before committing it.

Thanks for the review,

Manuel.


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