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

H.J. Lu hjl.tools@gmail.com
Fri Mar 7 19:11:00 GMT 2008


Compiler will allocate space for

const int conststaticvariable;

You just may not know what value will be in all cases. Here is the
updated with additional testcases. OK to install if tests on Linux/x86
and Linux/Intel64 as well as 483.xalancbmk passes?

H.J.
On Fri, Mar 7, 2008 at 9:00 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-local-3.patch
Type: text/x-patch
Size: 3601 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080307/cf2d8743/attachment.bin>


More information about the Gcc-patches mailing list