[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Mis-parse in some situations involving a function poi
From: |
Ben Bacarisse |
Subject: |
Re: [Tinycc-devel] Mis-parse in some situations involving a function pointer with attributes (breaks SQLite build) |
Date: |
Wed, 25 Jul 2018 11:56:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Jonathan Newman <address@hidden> writes:
> I happened across this issue while trying to build SQLite. I've attached a
> test case. To
> summarise:
> * Start off with a function pointer, correctly assigned to a function that
> has attributes,
> but cast to a void* (or indeed anything except the correct function pointer
> type)
> * Cast this void* to the correct function pointer type, and call it
> * Observe that one cast+call syntax works correctly, and another results in a
> misparse:
> * tcc thinks the type of the entire expression (cast+call) is a pointer,
> instead of the
> correct return type of the called function (here, an integer).
> * gcc happily accepts both syntaxes
> * This breaks compilation of the sqlite.c amalgamation, at least on 32-bit
> windows
>
> The failing syntax is perhaps unusual. It might actually be deliberately
> unsupported,
> but in that case:
> * sqlite will not build without modifications
> * tcc should stop here with an error instead of erroneously treating the
> expression as a
> pointer
>
> Hope someone can take a look at this. It can be worked around with some
> modifications to sqlite.
What versions are you using (of both tcc and sqlite.c)? With
sqlite-324000 and tcc version 0.9.27 (x86_64 Linux) I get no errors, and
your test example also compiles (and runs) error-free.
Can you cite the part of the sqlite source that causes the problem?
I could not find any similar syntax, but then "grep"ing for syntax often
does not work.
Converting between object pointers and function pointers is not
permitted in standard C, so a test example without that would be better.
Obviously I can't investigate to see if that's an important part of the
bug because I can't see the issue to start with!
--
Ben.