On Fri, Jul 22, 2005 at 07:54:51PM -0400, Russ Cox wrote:
> This is tcc compiled from CVS earlier this afternoon.
> It appears that the type of a ?: expression with function
> pointers in the arms somehow gets deduced to be
> some form of integer type instead of function pointer.
Known problem. See attached patch (note: this is against an old version
but will probably apply anyway).
-Dave Dodge
Dave Dodge 20041111
The problem is that tcc doesn't have any code to recognize function
pointers within a conditional expression, so it defaults to treating
them as integers. The resulting expression then has integer type,
which of course isn't valid for a function call. Here's a quick (but
somewhat incomplete) workaround.
--- tcc-0.9.22/tcc.c 2004-11-08 15:47:16.000000000 -0500
+++ tcc-0.9.22-fixed/tcc.c 2004-11-11 02:55:54.000000000 -0500
@@ -7598,6 +7598,9 @@
} else if (bt1 == VT_PTR || bt2 == VT_PTR) {
/* XXX: test pointer compatibility */
type = type1;
+ } else if (bt1 == VT_FUNC || bt2 == VT_FUNC) {
+ /* XXX: test function pointer compatibility */
+ type = type1;
} else if (bt1 == VT_STRUCT || bt2 == VT_STRUCT) {
/* XXX: test structure compatibility */
type = type1;
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel