[PATCH] Fix problematic folding
Eric Botcazou
ebotcazou@adacore.com
Fri Aug 1 14:35:00 GMT 2008
> 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
More information about the Gcc-patches
mailing list