This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix problematic folding


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]