public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Michael Matz <matz@suse.de>
Cc: Richard Guenther <richard.guenther@gmail.com>,
	Paolo Bonzini <bonzini@gnu.org>,
	gcc-patches@gcc.gnu.org
Subject: PATCH: PR middle-end/48440: [4.7 Regression] FAIL: gcc.c-torture/compile/labels-3.c
Date: Tue, 05 Apr 2011 00:51:00 -0000	[thread overview]
Message-ID: <BANLkTikGt_eSbSiB+-dJRBrs5ExrBiYfOg@mail.gmail.com> (raw)

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

On Mon, Apr 4, 2011 at 3:00 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Apr 3, 2011 at 3:14 AM, Michael Matz <matz@suse.de> wrote:
>> Hi,
>>
>> On Thu, 31 Mar 2011, Richard Guenther wrote:
>>
>>> > In the meanwhile, is the below version okay?
>>>
>>> If it bootstraps & tests ok then yes.  The java parts look obvious.
>>
>> So, we indeed can't remove the other calls to
>> canonicalize_constructor_val, because of local ctors.  And fortran has a
>> similar problem with java.  Instead of fixing up all these places of
>> resetting cfun (where otherwise the frontends don't deal at all with it,
>> it's mostly just set from the various cgraph routines), I decided to
>> simply clear this at the appropriate place in
>> cgraph_finalize_compilation_unit.
>>
>> Regstrapping in progress again.  Still okay if that works?
>>
>>
>> Ciao,
>> Michael.
>> --
>>        * cgraphbuild.c (record_reference): Canonicalize constructor
>>        values.
>
>>
>> Index: cgraphbuild.c
>> ===================================================================
>> --- cgraphbuild.c.orig  2011-04-03 11:28:45.000000000 +0200
>> +++ cgraphbuild.c       2011-04-03 11:31:21.000000000 +0200
>> @@ -53,6 +53,12 @@ record_reference (tree *tp, int *walk_su
>>   tree decl;
>>   struct record_reference_ctx *ctx = (struct record_reference_ctx *)data;
>>
>> +  t = canonicalize_constructor_val (t);
>> +  if (!t)
>> +    t = *tp;
>> +  else if (t != *tp)
>> +    *tp = t;
>> +
>>   switch (TREE_CODE (t))
>>     {
>>     case VAR_DECL:
>
> This change caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48440
>

This avoids  canonicalizing constructor values for address conversion
if Pmode != ptr_mode.  OK for trunk?

Thanks.

-- 
H.J.
----
2011-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/48440
	* cgraphbuild.c (record_reference): Don't canonicalize constructor
	values for address conversion if Pmode != ptr_mode.

[-- Attachment #2: gcc-pr48440-1.patch --]
[-- Type: text/plain, Size: 930 bytes --]

2011-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/48440
	* cgraphbuild.c (record_reference): Don't canonicalize constructor
	values for address conversion if Pmode != ptr_mode.

diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 3948cf6..8ba7864 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -49,15 +49,20 @@ struct record_reference_ctx
 static tree
 record_reference (tree *tp, int *walk_subtrees, void *data)
 {
-  tree t = *tp;
+  tree t = *tp, tc;
   tree decl;
   struct record_reference_ctx *ctx = (struct record_reference_ctx *)data;
 
-  t = canonicalize_constructor_val (t);
-  if (!t)
-    t = *tp;
-  else if (t != *tp)
-    *tp = t;
+  tc = canonicalize_constructor_val (t);
+  if (tc
+      && tc != t
+      && !(Pmode != ptr_mode
+	   && TREE_CODE (tc) == ADDR_EXPR
+	   && TREE_CODE (t) == CONVERT_EXPR))
+    {
+      *tp = tc;
+      t = tc;
+    }
 
   switch (TREE_CODE (t))
     {

             reply	other threads:[~2011-04-05  0:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05  0:51 H.J. Lu [this message]
2011-04-05  6:44 ` Paolo Bonzini
2011-04-05 10:30   ` Richard Guenther
2011-04-06 17:03     ` H.J. Lu
2011-04-07  8:51       ` Richard Guenther
2011-04-07 12:35         ` Michael Matz
2011-04-07 14:05           ` H.J. Lu
2011-04-15 23:34             ` Steve Ellcey
2011-04-16  0:59               ` Michael Matz
2011-04-18 18:23                 ` Steve Ellcey
2011-04-18 21:27                   ` Richard Guenther

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=BANLkTikGt_eSbSiB+-dJRBrs5ExrBiYfOg@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.de \
    --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).