From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id A9D7D3856DC0; Fri, 21 Oct 2022 16:42:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A9D7D3856DC0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 935F61063; Fri, 21 Oct 2022 09:42:44 -0700 (PDT) Received: from [10.57.6.65] (unknown [10.57.6.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A234D3F67D; Fri, 21 Oct 2022 09:42:37 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------7HsJQr2MzXr004uOIXrGm5HO" Message-ID: <129db1b0-0d2a-b768-bc80-9f73d665e8f8@arm.com> Date: Fri, 21 Oct 2022 17:42:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener , Richard Sandiford , ebotcazou@gcc.gnu.org From: "Andre Vieira (lists)" Subject: vect: Make vect_check_gather_scatter reject offsets that aren't multiples of BITS_PER_UNIT [PR107346] X-Spam-Status: No, score=-18.4 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: This is a multi-part message in MIME format. --------------7HsJQr2MzXr004uOIXrGm5HO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, The ada failure reported in the PR was being caused by vect_check_gather_scatter failing to deal with bit offsets that weren't multiples of BITS_PER_UNIT. This patch makes vect_check_gather_scatter reject memory accesses with such offsets. Bootstrapped and regression tested on aarch64 and x86_64. I wasn't sure whether I should add a new Ada test that shows the same failure without the bitfield lowering, I suspect this is such a rare form of data-structure that is why no other tests have highlighted the failure. Let me know if you would like me to add it still, the change is quite simple, just change the Int24 -> Int32 type in the structure. The 'thing' that causes the failure is the 4-bit member inside the packed structure before the field we access, giving it a 4-bit offset. I attempted but failed to create a C test using __attribute__((packed)). Kind Regards, Andre gcc/ChangeLog:         PR tree-optimization/107346         * tree-vect-data-refs.cc (vect_check_gather_scatter): Reject offsets that aren't         multiples of BITS_PER_UNIT. --------------7HsJQr2MzXr004uOIXrGm5HO Content-Type: text/plain; charset=UTF-8; name="pr107346.patch" Content-Disposition: attachment; filename="pr107346.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2djYy90cmVlLXZlY3QtZGF0YS1yZWZzLmNjIGIvZ2NjL3RyZWUtdmVj dC1kYXRhLXJlZnMuY2MKaW5kZXggNGEyM2Q2MTcyYWFhMTJhZDcwNDlkYzYyNmU1YzRhZmJk NWNhM2Y3NC4uNmM4OTI3OTFiZDRjMzlmNjcyYWRkNGU0YzIyYTlkNzgzNWUyOTJkNiAxMDA2 NDQKLS0tIGEvZ2NjL3RyZWUtdmVjdC1kYXRhLXJlZnMuY2MKKysrIGIvZ2NjL3RyZWUtdmVj dC1kYXRhLXJlZnMuY2MKQEAgLTQwMTYsNiArNDAxNiwxMSBAQCB2ZWN0X2NoZWNrX2dhdGhl cl9zY2F0dGVyIChzdG10X3ZlY19pbmZvIHN0bXRfaW5mbywgbG9vcF92ZWNfaW5mbyBsb29w X3ZpbmZvLAogICBpZiAocmV2ZXJzZXApCiAgICAgcmV0dXJuIGZhbHNlOwogCisgIC8qIFBS IDEwNzM0Ni4gIFBhY2tlZCBzdHJ1Y3RzIGNhbiBoYXZlIGZpZWxkcyBhdCBvZmZzZXRzIHRo YXQgYXJlIG5vdAorICAgICBtdWx0aXBsZXMgb2YgQklUU19QRVJfVU5JVC4gIERvIG5vdCB1 c2UgZ2F0aGVyL3NjYXR0ZXJzIGluIHN1Y2ggY2FzZXMuICAqLworICBpZiAoIW11bHRpcGxl X3AgKHBiaXRwb3MsIEJJVFNfUEVSX1VOSVQpKQorICAgIHJldHVybiBmYWxzZTsKKwogICBw b2x5X2ludDY0IHBieXRlcG9zID0gZXhhY3RfZGl2IChwYml0cG9zLCBCSVRTX1BFUl9VTklU KTsKIAogICBpZiAoVFJFRV9DT0RFIChiYXNlKSA9PSBNRU1fUkVGKQo= --------------7HsJQr2MzXr004uOIXrGm5HO--