public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/ibuclaw/heads/darwin)] d: Force TYPE_MODE of classes and non-POD structs as BLKmode
Date: Tue, 22 Dec 2020 13:40:22 +0000 (GMT)	[thread overview]
Message-ID: <20201222134022.6DB153833002@sourceware.org> (raw)

https://gcc.gnu.org/g:a0f42eb291e98e74eefa9a204492af943427fe76

commit a0f42eb291e98e74eefa9a204492af943427fe76
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue Dec 22 09:47:22 2020 +0100

    d: Force TYPE_MODE of classes and non-POD structs as BLKmode
    
    Without this being forced, the optimizer could still make decisions that
    require objects of the non-POD types to need a temporary, which would
    result in an ICE during the expand to RTL passes.
    
    gcc/d/ChangeLog:
    
            * types.cc (TypeVisitor::visit (TypeStruct *)): Set TYPE_MODE of all
            non-trivial types as BLKmode.
            (TypeVisitor::visit (TypeClass *)): Likewise.

Diff:
---
 gcc/d/types.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index 94aa1f6b9b3..acb8c409526 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -964,7 +964,10 @@ public:
     if (!t->sym->isPOD ())
       {
 	for (tree tv = t->ctype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv))
-	  TREE_ADDRESSABLE (tv) = 1;
+	  {
+	    TREE_ADDRESSABLE (tv) = 1;
+	    SET_TYPE_MODE (tv, BLKmode);
+	  }
       }
   }
 
@@ -999,7 +1002,10 @@ public:
 
     /* Classes only live in memory, so always set the TREE_ADDRESSABLE bit.  */
     for (tree tv = basetype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv))
-      TREE_ADDRESSABLE (tv) = 1;
+      {
+	TREE_ADDRESSABLE (tv) = 1;
+	SET_TYPE_MODE (tv, BLKmode);
+      }
 
     /* Type is final, there are no derivations.  */
     if (t->sym->storage_class & STCfinal)


                 reply	other threads:[~2020-12-22 13:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201222134022.6DB153833002@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).