This is the mail archive of the gcc-bugs@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]

[Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64255

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I had:
__attribute__((noinline, noclone))
void
bar (long i, unsigned long j)
{
  if (i != 1 || j != 1)
    __builtin_abort ();
}

__attribute__((noinline, noclone))
void
foo (long i)
{
  unsigned long j;

  if (!i)
    return;
  j = i >= 0 ? (unsigned long) i : - (unsigned long) i;
  if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != j)
    __builtin_abort ();
  bar (i, j);
}

int
main ()
{
  foo (1);
  return 0;
}

In any case, regressed with r217646, works with -O0/-O1, or -O2 -m32, fails
with -O2 (on x86_64-linux).


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