Hi,
This seems to be the issue causing SQLite compilation to fail (or at least part of it/related to it).
When a function pointer is declared in a particular way, it seems that __stdcall (and presumably other attributes?) are ignored. As a result, TCC thinks the function is caller-cleanup when it is not, and the stack gets "cleaned" twice.
See the full test case attached. As a quick summary,
This works:
((int __stdcall (*)(int, int, int))some_stdcall_func) (2, 0, 0);
And so does this:
((int(*__stdcall)(int, int, int))some_stdcall_func) (3, 0, 0);
But this fails:
((int(__stdcall*)(int, int, int))some_stdcall_func) (4, 0, 0);
This is mostly relevant on 32-bit Windows (where the stdcall convention is common).