[committed] Fix pr81423.c testcase (PR rtl-optimization/81423)
Jakub Jelinek
jakub@redhat.com
Sat Oct 14 09:36:00 GMT 2017
Hi!
The original C++ testcase has been transcribed into C and during
that process a UB has been introduced, original had
unsigned(5677365550390624949LL - ll) - (ull1 > 0)
while what has been committed has
(5677365550390624949L - ll) - (ull1 > 0)
I've also changed all L suffixed constants to LL for consistency with
ilp32 (the testcase has been written for x86_64 lp64 apparently)
and added better check that int is 32-bit and long long 64-bit.
Tested on x86_64-linux and i686-linux and verified that using Jul 14th
cc1 still fails on lp64, committed to trunk as obvious.
2017-10-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/81423
* gcc.c-torture/execute/pr81423.c (foo): Add missing cast. Change L
suffixes to LL.
(main): Punt if either long long isn't 64-bit or int isn't 32-bit.
--- gcc/testsuite/gcc.c-torture/execute/pr81423.c.jj 2017-09-01 09:26:12.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr81423.c 2017-10-14 10:31:25.000050882 +0200
@@ -1,3 +1,5 @@
+/* PR rtl-optimization/81423 */
+
extern void abort (void);
unsigned long long int ll = 0;
@@ -10,11 +12,11 @@ foo (void)
{
ll = -5597998501375493990LL;
- ll = (5677365550390624949L - ll) - (ull1 > 0);
+ ll = (unsigned int) (5677365550390624949LL - ll) - (ull1 > 0);
unsigned long long int ull3;
ull3 = (unsigned int)
- (2067854353L <<
- (((ll + -2129105131L) ^ 10280750144413668236ULL) -
+ (2067854353LL <<
+ (((ll + -2129105131LL) ^ 10280750144413668236ULL) -
10280750143997242009ULL)) >> ((2873442921854271231ULL | ull2)
- 12098357307243495419ULL);
@@ -24,9 +26,10 @@ foo (void)
int
main (void)
{
- /* We need a long long of exactly 64 bits for this test. */
- ll--;
- if (ll != 0xffffffffffffffffULL)
+ /* We need a long long of exactly 64 bits and int of exactly 32 bits
+ for this test. */
+ if (__SIZEOF_LONG_LONG__ * __CHAR_BIT__ != 64
+ || __SIZEOF_INT__ * __CHAR_BIT__ != 32)
return 0;
ull3 = foo ();
Jakub
More information about the Gcc-patches
mailing list