From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 3D48B384BC3A for ; Thu, 6 Oct 2022 09:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D48B384BC3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x333.google.com with SMTP id o20-20020a05600c4fd400b003b4a516c479so565062wmq.1 for ; Thu, 06 Oct 2022 02:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7vb3M2hW9Zf/03QihnmzzjLTZKc1aNkfpDF42p8Hy5s=; b=F8jjRuowTkkoJPlVZ3aW0fd+hKuCli1ZUFP3gNHAl7gHP1vqdg/ekcWwOFXE8203ST AWz8G5lquDfyNWznvlPFiVdA+5i3AbxH7B1hXmE0goV6R9T+/qv1XivcRghhd6A7HERd 5Gb60xntiFzPSmDigmrOliI3qQUZe/46K2EMuVBFUy67CXlHdzLsUZO95h5B3yg75nso qxK3mTTs+2g5bEP/oyMmS4/WrwanBOnknLpAqLPDoDsdnzhZ+JFKzpFtcrtPd8vUvAOm AL3MBa5PW71CwqHi3flcLIt2WtQdcwwI00uHWYFnxSuJ/U3rKoWbQTMe8EsS48eSE9T7 FNGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7vb3M2hW9Zf/03QihnmzzjLTZKc1aNkfpDF42p8Hy5s=; b=Jgum/NhqNuBOnvaHn9hkCCqizMmfeXuLs5ruSSqrHWw9SdzmlP7ks3bCWtFFluIhhw OUNA+bXttsiShHH65CRWF8Tgp+2K0/6cbuv0U8az+lx3wITywdUfTIXu7x9cEb4y7s6r 5zL3FYSn/ulwHzr4MFALc69CxpoQ/54+GzRq0vbUbFCLt/Fv/REsmf/nj2+ThcBLMXLH 5flzeeZ/J5x3ieg8yI9nVfKp1kdJ+YAp0DP8V9gd4HWvShRDTtxqPT8A/gCOxHJdPW6C GzaVDLMeTIyhxUtMHbpAQ2whHUcPBUMicLLh/KadwYGwsHWxhuGStVjJdMLNfG2Os/8/ WsTw== X-Gm-Message-State: ACrzQf1nHjD4aM8D10SUgkPBUKGuL8wNQNps9DMi2iFBKpRB1RGGPZ1p fHRxCiYhH55T3kLiAwQw/EfZ/Zea/jW1GB7M X-Google-Smtp-Source: AMsMyM73/dvttI5AnperPZHPA2oE5+nqnf+5gGhuula1jMHfFg6JTY8ES+2hYwDomuGva1P/uIPkDQ== X-Received: by 2002:a05:600c:d5:b0:3c0:fba1:d2b9 with SMTP id u21-20020a05600c00d500b003c0fba1d2b9mr2273608wmm.108.1665048419759; Thu, 06 Oct 2022 02:26:59 -0700 (PDT) Received: from poulhies-Precision-5550.lan (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id j8-20020a05600c190800b003bfaba19a8fsm4468440wmq.35.2022.10.06.02.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 02:26:59 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITED] ada: Disable slice-of-component optimization in some cases Date: Thu, 6 Oct 2022 11:26:43 +0200 Message-Id: <20221006092643.260420-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Bob Duff This patch disables the Fast_Copy_Bitfield optimization in certain rare cases that currently do not work (crash in gigi). We could improve Expand_Assign_Array_Bitfield_Fast to handle these cases properly, but that change is delicate, so for now, we simply disable the optimization. gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Disable the Fast_Copy_Bitfield optimization in certain cases. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch5.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 209741c82cf..9669737a79b 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -1660,6 +1660,15 @@ package body Exp_Ch5 is return False; end Volatile_Or_Independent; + function Slice_Of_Packed_Component (L : Node_Id) return Boolean is + (Nkind (L) = N_Slice + and then Nkind (Prefix (L)) = N_Indexed_Component + and then Is_Bit_Packed_Array (Etype (Prefix (Prefix (L))))); + -- L is the left-hand side Name. Returns True if L is a slice of a + -- component of a bit-packed array. The optimization is disabled in + -- that case, because Expand_Assign_Array_Bitfield_Fast cannot + -- currently handle that case correctly. + L : constant Node_Id := Name (N); R : constant Node_Id := Expression (N); -- Left- and right-hand sides of the assignment statement @@ -1681,6 +1690,7 @@ package body Exp_Ch5 is and then not Reverse_Storage_Order (R_Type) and then Ndim = 1 and then Slices + and then not Slice_Of_Packed_Component (L) and then not Volatile_Or_Independent (L, L_Type) and then not Volatile_Or_Independent (R, R_Type) then -- 2.34.1