The "tcc -run" is irrelevant - I shouldn't have mentioned that.
The intent was to make the test case easy to reproduce.

The bug I'm trying to report seems to be libtcc-specific.
I see the same thing when compiling to executable:

tcc tcc-libtcc-address-bug.c -ltcc && ./a.out
clang tcc-libtcc-address-bug.c -ltcc && ./a.out
gcc tcc-libtcc-address-bug.c -ltcc && ./a.out

In all cases test1() works but test2() dereference random values
(run-to-run return value is usually different and sometimes it crashes).

For the record, I build  in a subdirectory, after: ../configure
--source-path=/home/raible/tinycc
BTW this is not blocking me in any way but I did find it so I thought I'd
report it.

Thanks - Eric


On Sat, Dec 20, 2025 at 12:55 AM Herman ten Brugge via Tinycc-devel <
[email protected]> wrote:

> On 12/19/25 22:29, Eric Raible wrote:
>
> This is a libtcc issue: gcc and clang behave the same way.
>
> // libtcc mangles casts of hard-coded pointer values// Run with: tcc -run 
> tcc-libtcc-address-bug.c// The 2nd call to 'test()' produces incorrect 
> results, and often crashes with SIGSEGV.//// tcc version 0.9.28rc 2025-12-15 
> mob@85694274 (AArch64 Linux)// uname -a => Linux penguin 
> 6.6.88-08646-g082267a5c5ac #1 SMP PREEMPT Fri, 29 Aug 2025 06:42:16 -0700 
> aarch64 GNU/Linux
>
> Did you configure tcc with '--disable-static'?
> Without this you will overwrite the tcc_new() of the current code.
>
>     Herman
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to