From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1873) id 6DB153833002; Tue, 22 Dec 2020 13:40:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DB153833002 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Iain Buclaw 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 X-Act-Checkin: gcc X-Git-Author: Iain Buclaw X-Git-Refname: refs/users/ibuclaw/heads/darwin X-Git-Oldrev: 027935eec43173a89cd3eeace0b51967288ac075 X-Git-Newrev: a0f42eb291e98e74eefa9a204492af943427fe76 Message-Id: <20201222134022.6DB153833002@sourceware.org> Date: Tue, 22 Dec 2020 13:40:22 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2020 13:40:22 -0000 https://gcc.gnu.org/g:a0f42eb291e98e74eefa9a204492af943427fe76 commit a0f42eb291e98e74eefa9a204492af943427fe76 Author: Iain Buclaw 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)