This is the mail archive of the
mailing list for the GCC project.
Re: PATCH - Restore TREE_STATIC flag of previous decl when C99 6.2.7p2 rule is enforced.
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: mark at codesourcery dot com
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Nov 2003 09:09:34 -0800
- Subject: Re: PATCH - Restore TREE_STATIC flag of previous decl when C99 6.2.7p2 rule is enforced.
On Tuesday, November 11, 2003, at 03:44 PM, Mark Mitchell wrote:
On Sat, 2003-11-08 at 22:17, Richard Henderson wrote:
On Sat, Nov 08, 2003 at 11:31:01AM -0800, Fariborz Jahanian wrote:
Problem is that as a side-effect of call to duplicate_decls to
the C99 rule, the TREE_STATIC flag for the
implicit declaration for simple_cst_equal, used in first call to
simple_cst_equal is changed to that of current
declaration (true). darwin back-end has already seen TREE_STATIC to
false in generating the call as a relocatable call....
I think it's a bug that TREE_STATIC is ever not set for a function.
Certainly it's a bug that darwin looks at it at all.
The documentation says:
/* In a VAR_DECL, nonzero means allocate static storage.
In a FUNCTION_DECL, nonzero if function has been defined.
In a CONSTRUCTOR, nonzero means allocate static storage. */
#define TREE_STATIC(NODE) ((NODE)->common.static_flag)
So, there's a valid reason for it to be unset.
Yes, I followed above documentation. Next question which I raised in my
patch was what if back-end checks on this
flag to decide certain style of address generation? This is being done
in darwin.c as well as winnt.c. In my original test case,
this flag for the FUNCTION_DECL entry was unset (function not yet
defined), so address for function call is generated as relocatable.
Then this flag is set when C99 rule is enforced. So, I preserve the
flag (unset) on the original call so
proper stub is generated at the end. If I cannot do this, then I agree
with Richard that this flag should not be used in
darwin.c on a per function basis, as its final value is not known until
the whole TU is seen.
- Fariborz Jahanian <firstname.lastname@example.org>
Mark Mitchell <email@example.com>