That did not help. It seems that there is a problem on ARM or Apple Silicon, specifically:
#include <stdio.h>
int main() {
printf("%%lu: %lu\n", sizeof("this is a string"));
printf("%%d: %d\n", sizeof("this is a string"));
printf("%%zu: %zu\n", sizeof("this is a string"));
}
CLANG:
$ clang tcc-string-literal-sizeof.c ; and ./a.out
tcc-string-literal-sizeof.c:4:23: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
printf("%%d: %d\n", sizeof("this is a string"));
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
%lu
1 warning generated.
%lu: 17
%d: 17
%zu: 17
GCC:
$ gcc tcc-string-literal-play.c ; and ./a.out
tcc-string-literal-play.c: In function ‘main’:
tcc-string-literal-play.c:5:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
5 | printf("%%d: %d\n", sizeof("this is a string"));
| ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| int long unsigned int
| %ld
%lu: 17
%d: 17
%zu: 17
TCC (on Linux x86_64):
$ ./tcc -run ../tcc-string-literal-play.c
%lu: 17
%d: 17
%zu: 17
TCC (on macOS w/ Apple Silicon):
$ tcc -run tcc-string-literal-sizeof.c
%lu: 6165754624
%d: 1870787328
%zu: 6165754624
$ tcc -run tcc-string-literal-sizeof.c
%lu: 6127891200
%d: 1832923904
%zu: 6127891200
$tcc -run tcc-string-literal-sizeof.c
%lu: 6100595456
%d: 1805628160
%zu: 6100595456