This is the mail archive of the gcc-patches@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]

Re: PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk


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


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