This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix problematic folding
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "Richard Guenther" <richard dot guenther at gmail dot com>
- Date: Fri, 1 Aug 2008 16:34:59 +0200
- Subject: Re: [PATCH] Fix problematic folding
- References: <200807311946.49872.ebotcazou@adacore.com> <84fc9c000807311428r78a4f1d2nfc35d49c6c6e0abc@mail.gmail.com>
> It should wrap around as we properly sign-/zero-extend based on
> TYPE_PRECISION nowadays. I suspect you lose some conversion to bool
> somewhere?
The type at stake is precisely boolean:
Boolean_Expr2 ()
{
boolean D.1999;
boolean D.2000;
boolean D.2001;
boolean D.2004;
boolean D.2005;
static boolean boolean_expr2__ident_bool (const boolean);
D.1999 = boolean_expr2__ident_bool (0);
D.2000 = D.1999 + 1;
D.2001 = !D.2000;
if (D.2001 != 0) goto <D.2002>; else goto <D.2003>;
<D.2002>:
__gnat_rcheck_19 ("boolean_expr2.adb", 12);
<D.2003>:
D.2004 = boolean_expr2__ident_bool (1);
D.2005 = D.2004 + 1;
if (D.2005 != 0) goto <D.2006>; else goto <D.2007>;
<D.2006>:
__gnat_rcheck_19 ("boolean_expr2.adb", 16);
<D.2007>:
return;
}
> Note that the other frontends specialize boolean arithmetic completely and
> never run into the above folding for bools.
Yes, I noticed this, that may end up being the safe approach.
--
Eric Botcazou