https://gcc.gnu.org/g:e47fb6bd059da41d2dceb3f75a3a7968600e09fe

commit r16-1889-ge47fb6bd059da41d2dceb3f75a3a7968600e09fe
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jul 1 11:58:28 2025 +0200

    testsuite: Fix up pr119318.c test for big-endian [PR120082]
    
    The test is not endianess clean, x[0] is supposed to be ((__int128)0x19)<<32
    on little endian - 0x19 is in the second vector elt - but 
((__int128)0x19)<<64
    on big endian.  I've added also verification of int and __int128 sizes just
    in case we have say 16-bit or 64-bit int target with __int128 type, or
    pdp endian gets __int128 support.
    
    2025-07-01  Jakub Jelinek  <ja...@redhat.com>
    
            PR ipa/119318
            PR testsuite/120082
            * gcc.dg/ipa/pr119318.c (main): Expect different result on big 
endian
            from little endian, on unexpected endianness or int/int128 sizes 
don't
            test anything.  Formatting fixes.

Diff:
---
 gcc/testsuite/gcc.dg/ipa/pr119318.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/ipa/pr119318.c 
b/gcc/testsuite/gcc.dg/ipa/pr119318.c
index f179aed50397..47698a5e751c 100644
--- a/gcc/testsuite/gcc.dg/ipa/pr119318.c
+++ b/gcc/testsuite/gcc.dg/ipa/pr119318.c
@@ -30,8 +30,14 @@ int
 main ()
 {
   W x = foo (0, (V) { 0, 5 });
-  for (unsigned i = 0; i < sizeof(x)/sizeof(x[0]); i++)
+  for (unsigned i = 0; i < sizeof (x) / sizeof (x[0]); i++)
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_INT__ == 4 && 
__SIZEOF_INT128__ == 16
     if (x[i] != (i ? 0 : 0x1900000000))
-      __builtin_abort();
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_INT__ == 4 && 
__SIZEOF_INT128__ == 16
+    if (x[i] != (i ? 0 : ((__int128) 0x19) << 64))
+#else
+    if (0)
+#endif
+      __builtin_abort ();
   return 0;
 }

Reply via email to