[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 13 16:27:23 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com,
| |uros at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the problem happens during combine. Parts of the vector code related
to:
V b = (V) { } >= o;
V c = b <= (V)(b >= (V) { 0, 0, 0, 0, 0, 0x90DF0BE3990AC871ULL });
- in particular the scalar c[5] computation, i.e.
unsigned long long b = 0 >= o ? -1ULL : 0ULL;
unsigned long long c = b <= (b >= 0x90DF0BE3990AC871ULL ? -1ULL : 0ULL) ? -1ULL
: 0ULL;
evaluates to 0 rather than -1 that it should when o is 0.
This boils down to:
__attribute__((noipa)) unsigned long long
foo (unsigned char o)
{
unsigned long long t1 = -(long long) (o == 0);
unsigned long long t2 = -(long long) (t1 > 10439075533421201520ULL);
unsigned long long t3 = -(long long) (t1 <= t2);
return t3;
}
int
main ()
{
if (foo (0) != -1ULL)
__builtin_abort ();
return 0;
}
at -O2 or -Os, which was miscompiled starting with r12-303-g86403f4e6e5f7216
and got fixed with r13-3530-g0e36a9c6915c713d30.
No idea why this is marked as 11 regression though...
So, do we need to backport PR107172 change to 12 branch?
More information about the Gcc-bugs
mailing list