From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 7F73B385840B for ; Fri, 4 Nov 2022 09:40:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F73B385840B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62a.google.com with SMTP id bj12so11722352ejb.13 for ; Fri, 04 Nov 2022 02:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=LipT/NbB6bTskd7Tx8tm68PNz8r17cwFe6lN0rTRjns=; b=UVSjti+dbgOgQZN/hjM/DrDI7XSZ/jp+ha7SHmnlHLgyzoxGoDKMuR1L1K0ihG6GXP HE75mpfqiuuRvvBpAgaxcAVz+rP3FHkBOljGAXIq092UjfVzsvLjgKTdYx4RaWkX48zd 3HMqGLqrQFXa+T4Sf+aoh2c4EBcb/k78QmaspZMFZ0NfCj06qCZrv9IOZ4tk7tHlnfgT +O8ikCJP38LHc80UZst+OtBduPS9CWrN9QcOaVd9Qyf5uHZgW3h+KCanHDT3aUpU9ax9 iUo4NvQswqKEw2nPzz0LNRgXt8knKopsiIi+fP1D5R6fy1BieLc7+q3dn3DBs5ZCjQ9M rfFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LipT/NbB6bTskd7Tx8tm68PNz8r17cwFe6lN0rTRjns=; b=3mh5QV593IdZsy0rrhjvUgpMruf/p9bkiDIH4N0AMZR2OMj5ivbJvhf1npwhoL726M slpVKQkr5bWUQqkDbgDmwDcPMC+da7M5RvS7H+o8l4oDxYQAuW7aFy7UhX3UFgR4FtB/ JPf/arFlHMz76QI8f55IJTZiPKjICxLu9Y0YHcCXFaU8QPn/+fr2BxSMHCvZSbRGKhkm a5IMOH6q3bpyQJW4QVFoVSmyMOVpQa2mnwlmdqmSvS8Db/3qHbX8Kyki+/EBioOTaIcS 578u0Imj8HAA4cqR04JsqoMmMId64nEqlOhJX0gKyXmv6drbJ5jh/crvZIQIx2Yr2nD+ W35Q== X-Gm-Message-State: ACrzQf3C/M7VqPDtFDyD2aUx7u2dpeYunV1SrNXjDxYb2R1eEdJrujiQ yqaqjFCzah4Eb+g9CcmUUGs2AUBzG9Y= X-Google-Smtp-Source: AMsMyM40Rnnxb4ktuNv4zmsbEZigI0+jbLO2NcL0XjSGH7EUFLoC8ixNT2EazbLjCwmIqbUmp6+pcQ== X-Received: by 2002:a17:907:7f2a:b0:7ae:3c2c:942d with SMTP id qf42-20020a1709077f2a00b007ae3c2c942dmr702165ejc.714.1667554849557; Fri, 04 Nov 2022 02:40:49 -0700 (PDT) Received: from smtpclient.apple ([2a02:3038:209:60a4:d162:2701:c04b:5287]) by smtp.gmail.com with ESMTPSA id ev21-20020a17090729d500b007a1d4944d45sm1583108ejc.142.2022.11.04.02.40.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Nov 2022 02:40:47 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] Fix recent thinko in operand_equal_p Date: Fri, 4 Nov 2022 10:40:35 +0100 Message-Id: <2F00FAAA-AA2A-428D-AC5D-52CCF0FEE86B@gmail.com> References: <7447720.EvYhyI6sBW@fomalhaut> Cc: gcc-patches@gcc.gnu.org In-Reply-To: <7447720.EvYhyI6sBW@fomalhaut> To: Eric Botcazou X-Mailer: iPhone Mail (20B82) X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_QP_LONG_LINE,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: > Am 04.11.2022 um 10:29 schrieb Eric Botcazou via Gcc-patches : >=20 > =EF=BB=BFHi, >=20 > there is a thinko in the recent improvement by Jan: >=20 > 2020-11-19 Jan Hubicka >=20 > * fold-const.c (operand_compare::operand_equal_p): Fix thinko in > COMPONENT_REF handling and guard types_same_for_odr by > virtual_method_call_p. > (operand_compare::hash_operand): Likewise. >=20 > where the code just looks at operand 2 of COMPONENT_REF, if it is present,= to=20 > compare addresses. That's wrong because operand 2 contains the number of=20= > DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all t= he=20 > bytes are included and some of them are in DECL_FIELD_BIT_OFFSET instead, s= ee=20 > get_inner_reference for the model computation. >=20 > In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN a= nd=20 > DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth th= e=20 > hassle in practice so the attached fix just removes this alternate handlin= g. > Tested on x86-64/Linux, OK for mainline, 12 and 11 branches? Ok. Thanks, Richard=20 >=20 > 2022-11-04 Eric Botcazou >=20 > * fold-const.cc (operand_compare::operand_equal_p) : > Do not take into account operand 2. > (operand_compare::hash_operand) : Likewise. >=20 >=20 > 2022-11-04 Eric Botcazou >=20 > * gnat.dg/opt99.adb: New test. > * gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper. > * gnat.dg/opt99_pkg2.ads: Likewise. >=20 > --=20 > Eric Botcazou > > > > >