This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR30338, ICE in fold_comparison
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 Dec 2006 09:51:34 -0700 (MST)
- Subject: Re: [PATCH] Fix PR30338, ICE in fold_comparison
On Sun, 31 Dec 2006, Richard Guenther wrote:
> /* Convert -1 - A to ~A. */
> if (INTEGRAL_TYPE_P (type)
> && integer_all_onesp (arg0))
> return fold_build1 (BIT_NOT_EXPR, type, arg1);
Historically, the better fix and prevalent idiom in fold-const.c would
be to use "fold_convert (type, arg1)" instead of "op1". There was a time
when "op1" couldn't be guaranteed to be of type "type" (but things are
improving), and the utility of stripping NON_LVALUE_EXPR and other junk
nodes is becoming less significant with my plans to obsolete/deprecate
that tree code (once the C front-end is actively maintained). So in the
near future, the benefits of avoiding allocating a new tree node and
leaking the old one, will probably outweigh traditional usage.
What do you think?