|
From: | Jonathan Newman |
Subject: | Re: [Tinycc-devel] Function pointers declared in a particular way result in a miscompilation |
Date: | Mon, 31 Dec 2018 23:25:10 +0000 |
Hello,
On Sat, 29 Dec 2018, Jonathan Newman wrote:
> 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);
Aha, thanks for the investigation and testcase, that really helps. This
particular problem is now fixed on trunk. Lacking win32 I can't
check if it completely fixes SQLite, but at least your testcase works when
cross compiled and run under wine.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |