Skip to content

Commit

Permalink
Patch Clang bug in __builtin_clzl by pushing volatile
Browse files Browse the repository at this point in the history
  • Loading branch information
Albin Ahlbäck committed Dec 11, 2024
1 parent f4fc052 commit 30c3332
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/longlong.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
extern "C" {
#endif

/* FIXME: Bug in Clang 18 */
#if __clang_major__ >= 18
# define CLANG_volatile volatile
#else
# define CLANG_volatile
#endif

#if defined(__GNUC__)

/* Trailing and leading zeros */
Expand Down Expand Up @@ -313,8 +320,8 @@ flint_bitcnt_t FLINT_BIT_COUNT(ulong x)

# define udiv_qrnnd(q, r, n1, n0, d) \
do { \
ulong __norm = flint_clz(d); \
if (__norm) \
CLANG_volatile int __norm = flint_clz(d); \
if (__norm != 0) \
{ \
udiv_qrnnd_int((q), (r), ((n1) << __norm) + ((n0) >> (FLINT_BITS - __norm)), (n0) << __norm, (d) << __norm); \
(r) = ((ulong) (r) >> __norm); \
Expand Down

0 comments on commit 30c3332

Please sign in to comment.