tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Function pointers declared in a particular way result


From: Michael Matz
Subject: Re: [Tinycc-devel] Function pointers declared in a particular way result in a miscompilation
Date: Mon, 31 Dec 2018 22:06:25 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]