This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Redeclaration of used symbols


Hi,
We currently accept the following testcase:

t()
{
}
static int t();
b()
{
	t();
}

when compiled with -fPIC we get an global symbol t that is called as if
it were local symbol in non-PIC way on i386.  I believe we get similar
misscompilations on most of other targets as well as confussion of the
unit-at-a-time code and such.

Is this valid C?  If so, what should be semantic in function-at-a-time
compilation?
If not, what is the best way to error about it? (check in
duplicate_decls whether entity has an initializer or is used comes into
mind)

Somewhat related and more crazy version of this in the testsuite:
extern inline int foo (void) { return 23; }
int bar (void) { return foo (); }
extern int foo (void) __attribute__ ((weak, alias ("xxx")));
int baz (void) { return foo (); }
int xxx(void) __asm__("xxx");
int xxx(void) { return 23; }
cgraphunit gets confused by finalizing extern inline function and
later missing duplicate_decls to remove DECL_SAVED_TREE of already
processed function.
What shall we do here?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]