From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 57ACC3858D33; Wed, 18 Oct 2023 15:07:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57ACC3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697641632; bh=QYl0xmsnrJotH/0HOk1Jv+WZ04qPJMJs9fKZkvqy8yw=; h=From:To:Subject:Date:From; b=Kn7jKjdUSDzXpjiz9IwBzB0+GDS6S0YLplnrsry4s5zTHn5F7oTCq0mfoN6eOGT8P U+FYSI88kkTOjKZkIrEN0vwNmM7kI+eQ0D4/7X3huNnwBzlRZh9wRT8tOByDoFeJAf jtWn/+JBU6RVHTSqoFouNP//At7Q5R3pkcWrIHcg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4722] cse: Workaround GCC < 5 bug in cse_insn [PR111852] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: ef10cb8683ae60c161eb88df381e02f95f6e3e30 X-Git-Newrev: bc4bd69faf986326f6b0fd0400cdd6871577afd1 Message-Id: <20231018150712.57ACC3858D33@sourceware.org> Date: Wed, 18 Oct 2023 15:07:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bc4bd69faf986326f6b0fd0400cdd6871577afd1 commit r14-4722-gbc4bd69faf986326f6b0fd0400cdd6871577afd1 Author: Jakub Jelinek Date: Wed Oct 18 17:01:26 2023 +0200 cse: Workaround GCC < 5 bug in cse_insn [PR111852] Before the r5-3834 commit for PR63362, GCC 4.8-4.9 refuses to compile cse.cc which contains a variable with rtx_def type, because rtx_def contains a union with poly_uint16 element. poly_int template has defaulted default constructor and a variadic template constructor which could have empty parameter pack. GCC < 5 treated it as non-trivially constructible class and deleted rtunion and rtx_def default constructors. For the cse_insn purposes, all we need is a variable with size and alignment of rtx_def, not necessarily rtx_def itself, which we then memset to 0 and fill in like rtx is normally allocated from heap, so this patch for GCC_VERSION < 5000 uses an unsigned char array of the right size/alignment. 2023-10-18 Jakub Jelinek PR bootstrap/111852 * cse.cc (cse_insn): Add workaround for GCC 4.8-4.9, instead of using rtx_def type for memory_extend_buf, use unsigned char arrayy with size of rtx_def and its alignment. Diff: --- gcc/cse.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/cse.cc b/gcc/cse.cc index c46870059e6c..f9603fdfd437 100644 --- a/gcc/cse.cc +++ b/gcc/cse.cc @@ -4951,8 +4951,15 @@ cse_insn (rtx_insn *insn) && is_a (mode, &int_mode) && (extend_op = load_extend_op (int_mode)) != UNKNOWN) { +#if GCC_VERSION >= 5000 struct rtx_def memory_extend_buf; rtx memory_extend_rtx = &memory_extend_buf; +#else + /* Workaround GCC < 5 bug, fixed in r5-3834 as part of PR63362 + fix. */ + alignas (rtx_def) unsigned char memory_extended_buf[sizeof (rtx_def)]; + rtx memory_extend_rtx = (rtx) &memory_extended_buf[0]; +#endif /* Set what we are trying to extend and the operation it might have been extended with. */