This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Dec 2014 17:45:10 +0000
- Subject: [Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
- Auto-submitted: auto-generated
- References: <bug-64255-4 at http dot gcc dot gnu dot org/bugzilla/>
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).