[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] pointers to static functions inside a static table
From: |
Aharon Robbins |
Subject: |
[Tinycc-devel] pointers to static functions inside a static table |
Date: |
Fri, 27 Aug 2010 13:47:35 +0300 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi. I've reported this before, but here is a small test case:
$ cat foo.c
#include <stdio.h>
static void func();
int main(int argc, char **argv)
{
static struct s {
void (*elem)();
} t[] = {
{ func } /* tcc requires these braces! */
};
printf("func is %p, t[0].func is %p\n", func, t[0].elem);
return 0;
}
static void func()
{
int x = 1;
x++;
}
$ gcc foo.c ; ./a.out
func is 0x4004f8, t[0].func is 0x4004f8
$ tcc foo.c ; ./a.out
func is 0x8048314, t[0].func is (nil)
This is from the mob branch. It's the only thing in my program (gawk)
that currently requires an ifdef for tcc.
As a second note, the braces where I put the comment should not really
be needed, but that is less important. So, two bug reports with one
program! Cool! :-)
Thanks!
Arnold Robbins
- [Tinycc-devel] pointers to static functions inside a static table,
Aharon Robbins <=