[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc broken on osx 10.13.6 since 62096265 "Add debug s

From: avih
Subject: Re: [Tinycc-devel] tcc broken on osx 10.13.6 since 62096265 "Add debug support to macos" (herman ten brugge)
Date: Sat, 18 Mar 2023 12:53:22 +0000 (UTC)

The patch below works for me. If you think it's good, please push it.
Feel free to modify it however you see fit.

The issue with your original patch was that __clang__ is only defined
when compiling the reference using clang, but not when compiling the
test using tcc.

In this patch, preprocessor CC_Name == CC_clang is apparently true both
when compiling the reference using clang, and the test using tcc.

- avih

diff --git a/tests/tcctest.c b/tests/tcctest.c
index 6ae5a77..6715406 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -3875,9 +3875,12 @@ static void builtin_test_bits(unsigned long long x, int cnt[])
if ((unsigned long) x) cnt[7] += __builtin_ctzl(x);
if ((unsigned long long) x) cnt[8] += __builtin_ctzll(x);

+#if CC_NAME != CC_clang || GCC_MAJOR >= 11
+ /* Apple clang 10 does not have __builtin_clrsb[l[l]] */
cnt[9] += __builtin_clrsb(x);
cnt[10] += __builtin_clrsbl(x);
cnt[11] += __builtin_clrsbll(x);

cnt[12] += __builtin_popcount(x);
cnt[13] += __builtin_popcountl(x);

On Saturday, March 18, 2023, 02:42:40 PM GMT+2, Herman ten Brugge <hermantenbrugge@home.nl> wrote:

On 3/18/23 13:13, avih wrote:
> On Saturday, March 18, 2023, 02:07:35 PM GMT+2, avih
> <avihpit@yahoo.com> wrote:
> > If I use #if 0 instead of #if !defined(__clang__) || GCC_MAJOR >= 11
> > then it does pass. Not quite sure what's going on.
> Ah, I do get it. When it compiles the reference using clang then
> these elements are 0, but when it compiles the test using tcc
> then __clang__ is not defined so this block is entered, and the
> builtins do exist, so it compiles successfully and works, but still
> different than the reference which has zeroes there.

You should probably make a patch that works for clang version 10.
Perhaps only 'GCC_MAJOR >= 11' does the trick. This disables the
test on older machines with gcc.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]