Re: [Tinycc-devel] find a bug

2025-05-16 Thread Harald Arnesen via Tinycc-devel
Sun via Tinycc-devel [2025-05-16 11:03:50]: #include int main(int argc, char **argv) { int64_t a=111,b=222; printf("%d %d\n",a,b); return 0; } output: 111 0 On Linux, it prints "111 222". Need to include , or "int64_t" is undefined. -- Hilsen Harald __

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
Or more appropriate, use “%lld” and use long long instead of int64_t > On 16 May 2025, at 13:15, Sun via Tinycc-devel > wrote: > > The problem is solved. > > int64_t a=123,b=234; > printf("%llu %llu\n",a,b); > > Just use %llu . > > Thanks! > > -- 原始邮件 -- > 发件

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
> On 16 May 2025, at 14:29, Vincent Lefevre wrote: > > On 2025-05-16 13:29:09 +0200, Charlie Gordon wrote: >> The correct portable way to print `int64_t` values is this: >> ``` >> #include >> #include >> #include >> >> int main(int argc, char **argv) { >> int64_t a =123, b = 234; >> prin

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Vincent Lefevre
On 2025-05-16 13:29:09 +0200, Charlie Gordon wrote: > The correct portable way to print `int64_t` values is this: > ``` > #include > #include > #include > > int main(int argc, char **argv) { >int64_t a =123, b = 234; >printf("%" PRId64 " %" PRId64 "\n", a, b); >return 0; > } > ```

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
The correct portable way to print `int64_t` values is this: ``` #include #include #include int main(int argc, char **argv) { int64_t a =123, b = 234; printf("%" PRId64 " %" PRId64 "\n", a, b); return 0; } ``` Microsoft compilers and libraries may be outdated and force you to use non

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Vincent Lefevre
On 2025-05-16 15:48:35 +0200, Charlie Gordon wrote: > On 16 May 2025, at 14:29, Vincent Lefevre wrote: > > This is portable because int64_t necessarily fits in a long long on > > any platform. > > This is correct, but only since C23. Previous versions of the C > Standard would have allowed `long

[Tinycc-devel] ?????? ?????? find a bug

2025-05-16 Thread Sun via Tinycc-devel
The problem is solved. int64_t a=123,b=234; printf("%llu %llu\n",a,b); Just use %llu . Thanks! --  -- ??: "avih"

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
The correct portable way to print `int64_t` values is this: ``` #include #include #include int main(int argc, char **argv) { int64_t a =123, b = 234; printf("%" PRId64 " %" PRId64 "\n", a, b); return 0; } ``` Microsoft compilers and libraries may be outdated and force you to use non p

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
Even better: long long a = 123, b = 234; printf("%lld %lld\n”, a, b); Just use %lld and long long. %llu is for unsigned values. Chqrlie. > On 16 May 2025, at 13:15, Sun via Tinycc-devel > wrote: > > The problem is solved. > > int64_t a=123,b=234; > printf("%llu %llu\n",a,b); > > Just use

Re: [Tinycc-devel] find a bug

2025-05-16 Thread avih via Tinycc-devel
I can confirm this output on Windows with mob f10ab130 (2025-03-28), but only with tcc 32 bit build. And, at least on Windows, it also needs #include However, this program is buggy, because the format %d is for int (32 bit on Windows), while the values are 64 bit, so a mismatch and undefined beh

[Tinycc-devel] find a bug

2025-05-16 Thread Sun via Tinycc-devel
#include ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel

[Tinycc-devel] ?????? find a bug

2025-05-16 Thread Sun via Tinycc-devel
Can I use %lu? My os is windows. #include https://lists.nongnu.org/mailman/listinfo/tinycc-devel___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Re: [Tinycc-devel] 回复: find a bug

2025-05-16 Thread avih via Tinycc-devel
No. long is also 32 bit on Windows. On Friday, May 16, 2025 at 02:00:54 PM GMT+3, Sun <809935...@qq.com> wrote: Can I use %lu? My os is windows. #include #include int main(int argc, char **argv) { int64_t a=123,b=234; printf("%lu %lu\n",a,b); return 0; } output: 123 0 -

[Tinycc-devel] ?????? find a bug

2025-05-16 Thread Sun via Tinycc-devel
Thank for your help! --  -- ??: "tinycc-devel" h

[Tinycc-devel] [linux/aarch64] fn call bug when one arg is a struct

2025-05-16 Thread kbkp...@sina.com
Under Linux/aarch64, when execute a function call with one arg is a struct, it pass wrong arg to the function call. a test code: mmm.c ```c #include struct vec { float x; float y; }; void bug(float y, float x) { printf("x=%f\ny=%f\n",x,y); } float dot(struct vec v) { return 10.0; } void mai