This is the mail archive of the
mailing list for the GCC project.
Re: PR c++/5310 Weird warnings about using (int)NULL
- From: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- To: "Nathan Sidwell" <nathan at codesourcery dot com>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>, "Gabriel Dos Reis" <gdr at integrable-solutions dot net>, "Mark Mitchell" <mark at codesourcery dot com>
- Date: Fri, 16 Nov 2007 12:01:41 +0100
- Subject: Re: PR c++/5310 Weird warnings about using (int)NULL
- References: <email@example.com> <473D41BB.firstname.lastname@example.org>
On 16/11/2007, Nathan Sidwell <email@example.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,