This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -Wconversion (PR c++/34198)
On Fri, Nov 23, 2007 at 03:39:26PM +0100, Manuel López-Ibáñez wrote:
> Using expr = get_unwidened (expr, TREE_TYPE (expr)) or expr =
> get_unwidened (expr, 0) passes this and all your testcases. And it
> makes the code much simpler and compact. Are you sure about this?
Yeah, expr = get_unwidened (expr, NULL_TREE); would work (while
expr = get_unwidened (expr, type); does not as I said earlier).
But get_narrower has the advantage of getting through multiple
conversions of the same precision, in case we decide e.g. to
further optimize away the warning for BIT_AND_EXPR where
one of the operands is INTEGER_CST mask which fits into
type.
That said, if you strongly prefer expr = get_unwidened (expr, NULL_TREE)
and Joseph or somebody else approves that, so be it.
Jakub