public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: "Richard Guenther" <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PING]: PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks C++ static member
Date: Mon, 10 Mar 2008 16:17:00 -0000	[thread overview]
Message-ID: <6dc9ffc80803100917k2575620aoccc90ee6eb4c5ac7@mail.gmail.com> (raw)
In-Reply-To: <20080310145545.GA9567@lucon.org>

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

On Mon, Mar 10, 2008 at 7:55 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> The current C++ compiler breaks C++ data member:
>
>  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35494
>
>  The current patch is at
>
>  http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00572.html
>
>  It passed all tests on Linux/x86 and Linux/Intel64 as well as
>  483.xalancbmk. OK to install?
>

Here is a smaller patch just for PR 35494. I am testing it on
Linux/x86 and Linux/Intel64 as well as 483.xalancbmk. OK to
install if all pases?

H.J.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-local-7.patch --]
[-- Type: text/x-patch; name=gcc-local-7.patch, Size: 3449 bytes --]

gcc/

2008-03-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR tree-optimization/35494
	* tree-ssa-ccp.c (get_symbol_constant_value): Check if value
	may be overriden at link and run time.

gcc/testsuite/

2008-03-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR tree-optimization/35494
	* g++.dg/tree-ssa/ssa-store-ccp-1.C: New.
	* gcc.dg/tree-ssa/ssa-store-ccp-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-store-ccp-3.c: Likewise.
	* gcc.dg/tree-ssa/ssa-store-ccp-4.c: Likewise.

--- gcc/testsuite/g++.dg/tree-ssa/ssa-store-ccp-1.C.local	2008-03-08 18:11:53.000000000 -0800
+++ gcc/testsuite/g++.dg/tree-ssa/ssa-store-ccp-1.C	2008-03-08 18:11:53.000000000 -0800
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+class bar
+{
+public:
+  static const int conststaticvariable;
+};
+
+
+int f(void)
+{
+  return bar::conststaticvariable;
+}
+
+/* There should be a reference to conststaticvariable since it may
+   be overriden at link time.  */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-2.c.local	2008-03-08 18:11:53.000000000 -0800
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-2.c	2008-03-08 18:11:53.000000000 -0800
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+const int conststaticvariable;
+
+int f(void)
+{
+  return conststaticvariable;
+}
+
+/* There should be a reference to conststaticvariable since it may
+   may be overriden at link time.  */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-3.c.local	2008-03-08 18:11:53.000000000 -0800
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-3.c	2008-03-08 18:11:53.000000000 -0800
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-common -fdump-tree-optimized" } */
+
+const int conststaticvariable;
+
+int f(void)
+{
+  return conststaticvariable;
+}
+
+/* There should be no reference to conststaticvariable as we should have
+   inlined the 0. */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 0 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-4.c.local	2008-03-08 18:11:53.000000000 -0800
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-4.c	2008-03-08 18:11:53.000000000 -0800
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fno-common -fpic -fdump-tree-optimized" } */
+
+const int conststaticvariable;
+
+int f(void)
+{
+  return conststaticvariable;
+}
+
+/* There should be a reference to conststaticvariable since it may
+   may be overriden at run time.  */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/tree-ssa-ccp.c.local	2008-03-07 09:02:37.000000000 -0800
+++ gcc/tree-ssa-ccp.c	2008-03-09 06:58:50.000000000 -0700
@@ -300,7 +300,10 @@ get_symbol_constant_value (tree sym)
 {
   if (TREE_STATIC (sym)
       && TREE_READONLY (sym)
-      && !MTAG_P (sym))
+      && !MTAG_P (sym)
+      /* Check if a read-only definition may be overridden at
+	 link and run time.  */
+      && targetm.binds_local_p (sym))
     {
       tree val = DECL_INITIAL (sym);
       if (val

  reply	other threads:[~2008-03-10 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 14:56 H.J. Lu
2008-03-10 16:17 ` H.J. Lu [this message]
2008-03-10 16:20   ` Richard Guenther
2008-03-18 19:22   ` David Daney
2008-03-18 20:51     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dc9ffc80803100917k2575620aoccc90ee6eb4c5ac7@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).