This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Mar 2008 09:00:33 -0800
- Subject: Re: PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk
- References: <20080307150023.GA8336@lucon.org>
On 3/7/08, H.J. Lu <hjl.tools@gmail.com> wrote:
> We can't fold glocal variables with NULL DECL_INITIAL. I am testing it
> on Linux/x86 and Linux/Intel64 as well as 483.xalancbmk. OK to install
> if all pass?
This patch is wrong because currently we check TREE_STATIC which says
we allocate space for the variable:
/* 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.
??? This is also used in lots of other nodes in unclear ways which
should be cleaned up some day. */
TREE_STATIC should not be set on those variables as there is no space
allocated in the case of the C++ case (I think Ada case also).
Also "const int conststaticvariable;" in C is global but it will be
put in the common section and is called a tentative definition. So
there needs to be another check for that instead of just TREE_PUBLIC.
That is if you compile:
const int conststaticvariable;
int f(void)
{
return conststaticvariable;
}
With -fno-common, the tentative definition is no longer one and we
should be able to optimize it.
Thanks,
Andrew Pinski