The test fell back to long long and long when __int128 is not available, but it assumed sizeof(long) < sizeof(long long) because of a shift count that would be out of range for a long long if their widths are the same. Fixed by splitting it up into two shifts.
Tested on x86_64-linux-gnu, -m64 and -m32. Hopefully Andrew and/or John David will let me know if it fails to fix the problem on the platforms in which they've observed it. Thanks for the report, sorry it took me so long to get to it. I'm going to install this as obvious, unless there are objections in the next few days. for gcc/testsuite/ChangeLog PR rtl-optimization/86438 * gcc.dg/torture/pr86438.c: Split up too-wide shift. --- gcc/testsuite/gcc.dg/torture/pr86438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr86438.c b/gcc/testsuite/gcc.dg/torture/pr86438.c index 3e95515ae6a6..5f8b463f7572 100644 --- a/gcc/testsuite/gcc.dg/torture/pr86438.c +++ b/gcc/testsuite/gcc.dg/torture/pr86438.c @@ -24,6 +24,6 @@ main (void) u64 d = (g ? 5 : 4); u32 f = __builtin_sub_overflow_p (d, (u128) d, (u64) 0); u128 x = g + f + d; - check (x >> (sizeof (u64) * __CHAR_BIT__), x); + check ((x >> 1) >> (sizeof (u64) * __CHAR_BIT__ - 1), x); return 0; } -- Alexandre Oliva, freedom fighter https://FSFLA.org/blogs/lxo Be the change, be Free! FSF Latin America board member GNU Toolchain Engineer Free Software Evangelist Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe