From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 267743858D35 for ; Wed, 22 Nov 2023 11:05:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 267743858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 267743858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.129.153 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700651126; cv=none; b=bQaURrFq8aKX+LHTRPCpbXmRwgb54fliaqDX0xmCBvXJg9+zoOrfqrQAdKApU/6GqJklEnKWCwQRphivInXt7ms9aO4x7W0Mv4bGBS7TLKy6jAToK6YSf7bStIj5hifaWSsTKN3BNrlTNAP2psYtD7CKfcZ0TfuN/omn20Wb1EQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700651126; c=relaxed/simple; bh=OdL3+wYQl5bt6bDRJzP6JNVyWPSzZK3T0IM2mxujiMo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tnk9yDdSnA2eDGewL3kExUQwVZzb3jZ3e/qFPii9dBrMdbM2QnRc9HNvzZC3m0vTQgyp8iJvCM20YSgtPCQrIbUTwKaU8yPOSwMTdZloXmMNnuaiGNc2oMfgkVZlgfRW2fpoScwxcru2bPpISxqQxt5/FezJOOsWzLxWcv17Lvs= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 68Z8dwMjSJuFJ2GbByZfJA== X-CSE-MsgGUID: 07sEOMK7Q9G/0KslWcPLMg== X-IronPort-AV: E=Sophos;i="6.04,218,1695715200"; d="scan'208";a="26479106" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 22 Nov 2023 03:05:22 -0800 IronPort-SDR: J+jvYqxCaIdwiYKICHcKH/YOYr255mfdGKZ7V35O2jR1kuMjkCfFuMu5Kd8YucgnJ+FvFbTVUd FZ+2gt/EtDjrQqfrnjpBtuuQuG7vp7WJYpYkc+1y0UxbokgGYQkxuMtH8Y1xpABAtmNCTMmy4e Nlz3ldDdyGtmF91Xn96Lq41FNkIGNM8I0B04K4HiP91CvTSGKM8/T10pFPj3YXbRr2z/sGnxdd m/eowpTXNLvOwAi1BlRo2fBzX921sYbo9ZTooV2Os9poH4JpCgGEmwnA3cewLj3W8mfn+MAUdQ ouU= From: Thomas Schwinge To: Christophe Lyon CC: Jan Hubicka , Subject: Re: Fix 'gcc.dg/tree-ssa/return-value-range-1.c' for 'char' defaulting to 'unsigned' (was: Propagate value ranges of return values) In-Reply-To: References: <871qcmkmgd.fsf@gentoo.org> <87r0kiu7f3.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 22 Nov 2023 12:05:09 +0100 Message-ID: <87fs0y121m.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On 2023-11-22T11:51:02+0100, Christophe Lyon w= rote: > On Tue, 21 Nov 2023 at 22:24, Thomas Schwinge w= rote: >> On 2023-11-19T16:05:42+0100, Jan Hubicka wrote: >> > --- /dev/null >> > +++ b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c >> >> Pushed to master branch commit a0240662b22312ffb3e3fefb85f258ab0e7010f4 >> "Fix 'gcc.dg/tree-ssa/return-value-range-1.c' for 'char' defaulting to >> 'unsigned'", see attached. On powerpc64le-linux-gnu ('char' defaulting >> to 'unsigned') I still saw: >> >> /tmp/ccd1xwD7.o: In function `test': >> return-value-range-1.c:(.text+0x50): undefined reference to `link_er= ror' >> > We do see the same error in our CI (Thomas, normally you have received > a notification because your patch turned ERROR in FAIL) Yes, I have; and I even tried to log in there, to point to my commit mentioned above, which is meant to address this issue -- please let me know if you're still seeing the FAIL after that commit. > Thomas, you said in another email that adding -O2 avoids the linker > error with missing link_error(), but I don't see how that would be > possible? That's the gist of Honza's "Propagate value ranges of return values" optimization, per my understanding: from 'int a(signed char c)' doing 'return c;' figure out that 'a(d) > 200)' is always false (due to '-128 <=3D c <=3D 127)'. > (and hence I expect the error you quoted above to happen) > > So should we use dg-compile instead of dg-link? Not sure what the > original intention was? No, the idea really is to prove that the 'link_error ()' call is unreachable. Gr=C3=BC=C3=9Fe Thomas >> > @@ -0,0 +1,22 @@ >> > +/* { dg-do ling } */ >> > +/* { dg-options "-O1 -dump-tree-evrp-details" } */ >> > +__attribute__ ((__noinline__)) >> > +int a(char c) >> > +{ >> > + return c; >> > +} >> > +void link_error (); >> > + >> > +void >> > +test(int d) >> > +{ >> > + if (a(d) > 200) >> > + link_error (); >> > +} >> > +int >> > +main(int argc, char **argv) >> > +{ >> > + test(argc); >> > + return 0; >> > +} >> > +/* { dg-final { scan-tree-dump-times "Recording return range" 2 "evrp= "} } */ ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955