Re: [COMMITTED] stdlib: Adapt tst-stdbit-builtins.c _BitInt tests on clang

Jakub Jelinek <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <aoyeO2wL4uFYM9bl@tucnak>
On Mon, Aug 24, 2026 at 04:10:20PM -0300, Adhemerval Zanella Netto wrote:
> On 23/08/26 08:54, Gabriel Ravier wrote:
> > (also, perhaps mildly unrelated but I noticed it while looking at the
> > same file: is `TEST_COMPARE (stdc_bit_floor (((unsigned _BitInt(373))
> > 512) << 242) != (((unsigned _BitInt(512)) 512) << 242), 0);` supposed to
> > have the two sides be different widths ?)
> 
> Hum it makes sense, I am ccing Jakub since he was the one that added this test.

Yes, it is a harmless pasto.
I'll test the following gcc patch soon and glibc, which has a test
based on that test, can be adjusted accordingly.

2026-08-24  Jakub Jelinek  <[email protected]>

	* gcc.dg/builtin-stdc-bit-1.c (main): Fix two pastos.

--- gcc/testsuite/gcc.dg/builtin-stdc-bit-1.c.jj	2026-03-27 10:17:16.877285978 +0100
+++ gcc/testsuite/gcc.dg/builtin-stdc-bit-1.c	2026-08-24 21:21:52.869918087 +0200
@@ -891,7 +891,7 @@ main ()
       || __builtin_stdc_bit_floor (~(unsigned _BitInt(373)) 0) != ((unsigned _BitInt(373)) 1) << (373 - 1))
     __builtin_abort ();
   if (__builtin_stdc_bit_floor (((unsigned _BitInt(512)) 511) << 405) != (((unsigned _BitInt(512)) 256) << 405)
-      || __builtin_stdc_bit_floor (((unsigned _BitInt(373)) 512) << 242) != (((unsigned _BitInt(512)) 512) << 242))
+      || __builtin_stdc_bit_floor (((unsigned _BitInt(373)) 512) << 242) != (((unsigned _BitInt(373)) 512) << 242))
     __builtin_abort ();
   if (__builtin_stdc_bit_ceil ((unsigned _BitInt(512)) 0) != 1
       || !expr_has_type (__builtin_stdc_bit_ceil ((unsigned _BitInt(512)) 0), unsigned _BitInt(512))
@@ -905,7 +905,7 @@ main ()
       || __builtin_stdc_bit_ceil ((~(unsigned _BitInt(373)) 0) >> 1) != ((unsigned _BitInt(373)) 1) << (373 - 1))
     __builtin_abort ();
   if (__builtin_stdc_bit_ceil (((unsigned _BitInt(512)) 512) << 405) != (((unsigned _BitInt(512)) 512) << 405)
-      || __builtin_stdc_bit_ceil (((unsigned _BitInt(373)) 513) << 242) != (((unsigned _BitInt(512)) 1024) << 242))
+      || __builtin_stdc_bit_ceil (((unsigned _BitInt(373)) 513) << 242) != (((unsigned _BitInt(373)) 1024) << 242))
     __builtin_abort ();
   if (__builtin_stdc_bit_floor ((unsigned _BitInt(__BITINT_MAXWIDTH__)) 0) != 0)
     __builtin_abort ();


	Jakub
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.