C identifier lookup speedups, 2/2
Zack Weinberg
zack@codesourcery.com
Fri Apr 11 21:10:00 GMT 2003
David Edelsohn <dje@watson.ibm.com> writes:
> With your recent patch,
>
> gcc.c-torture/execute/scope-2.c
>
> now fails with all options on AIX.
>
> ld: 0711-317 ERROR: Undefined symbol: v
>
> I do not know if any of the follow-up patches fixes it.
This program is ill-formed - the static decl 'v' at file scope refers
to the same object as the extern decl 'v' at block scope, which
induces undefined behavior. Having said that, I do not know why it
compiles and executes successfully on Linux but not on AIX.
My inclination is to "fix" this by causing the compiler to reject the
program, and move the test case to c-torture/noncompile. However,
this situation was specifically allowed in the old code:
#if 0
/* This case is probably sometimes the right thing to do. */
/* If we have a local external declaration,
then any file-scope declaration should not
have been static. */
if (oldlocal == 0 && oldglobal != 0
&& !TREE_PUBLIC (oldglobal)
&& DECL_EXTERNAL (x) && TREE_PUBLIC (x))
warning ("`%s' locally external but globally static",
IDENTIFIER_POINTER (name));
#endif
so I would like to get reactions from other people about what GCC
*should* do with this program before changing anything.
zw
More information about the Gcc-patches
mailing list