From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9D3163858D33 for ; Wed, 1 Mar 2023 13:32:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D3163858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677677541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNDXhetmV3CORYLKtr1RLTZODPI+dqzDQDL06I99Toc=; b=AWCrKZj6rNhhz5FBHpv3uFLWBzj8MPrvuNnpzc7FyJV3vXOwopFeYkLAC3i26I84z0p03o GQmyBz1zYf7A/nmpL5Gn0bDymiFNF1lVQkKOOfxmcpYLLzWybIcKyLSWjJKysRH31b0ROR K5wyKZD4exwuD9khYei5bgT08Tiykv4= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-158-oC9Q5OVoOA6rkrGCcsOQQA-1; Wed, 01 Mar 2023 08:32:20 -0500 X-MC-Unique: oC9Q5OVoOA6rkrGCcsOQQA-1 Received: by mail-qk1-f200.google.com with SMTP id s21-20020a05620a0bd500b0074234f33f24so7947106qki.3 for ; Wed, 01 Mar 2023 05:32:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677677534; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pNDXhetmV3CORYLKtr1RLTZODPI+dqzDQDL06I99Toc=; b=ZFR4YOQaRVtCXZtk8nZBmpmL/gHf36OwOAUlAaAivHhrRycTGJCjV5xsBQ4p/7XU2L JS4PqxXWBkQAyVJOsZ84z0R/QZnLSclIZJnLI1RPmfvWj16jY5RbOpmYL3RKDqi7KDFm A28TasBhu+x6vveGYI9JCzncNBbaB10Eh0iYAXP0QILusRWMakuMZl1YU5qFe9Pgh3xj EcRrrPXV/b8WMzah3o+q5i/v78Q9uUhkFUfd7qgIE4kYeYSMOJckpUsz4AwjLBo8TNOT 3lbxcwqcB79FN53KyOyIwFnUOrv4+hSsr9ZKFwd/ugTjNqI0mj1AWoj5kKSp5GJsni0S aFlA== X-Gm-Message-State: AO0yUKXpGmiLiqYNqdGzp4+DLCkROF3uVO5mz3LwOotO18r5M5RuqyFa mOwH70xvVW2SKaVog943S4QKqKHIOfrVyeapAATQAAaSkN5P8Ic8QLCdUZHjNci+XDuC0EyJ9rM PdZlZt6XbhcKBNi43Jngym0Q= X-Received: by 2002:a05:622a:50:b0:3bf:d9d2:487d with SMTP id y16-20020a05622a005000b003bfd9d2487dmr10998743qtw.8.1677677534685; Wed, 01 Mar 2023 05:32:14 -0800 (PST) X-Google-Smtp-Source: AK7set/+HczWIBvriQ8J/Z/F8HwChLIz1q4p7p2CwkTGhb03NpDRHPmmPnx4kkdo2vSqXytJh2F2ug== X-Received: by 2002:a05:622a:50:b0:3bf:d9d2:487d with SMTP id y16-20020a05622a005000b003bfd9d2487dmr10998718qtw.8.1677677534424; Wed, 01 Mar 2023 05:32:14 -0800 (PST) Received: from t14s.localdomain (c-73-69-212-193.hsd1.ma.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id c74-20020ae9ed4d000000b0074280fc7bd8sm8814955qkg.60.2023.03.01.05.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 05:32:13 -0800 (PST) Message-ID: Subject: Re: [PATCH 1/2] testsuite: Fix analyzer errors for newlib-errno From: David Malcolm To: Hans-Peter Nilsson Cc: gcc-patches@gcc.gnu.org Date: Wed, 01 Mar 2023 08:32:13 -0500 In-Reply-To: <20230301030123.A0A2B20438@pchp3.se.axis.com> References: <20230228184735.24E6E20438@pchp3.se.axis.com> <6bc39adefb2af674338a73408f75733b36ccbe0b.camel@redhat.com> <20230301005937.632A42042E@pchp3.se.axis.com> <9bc0171b3a54d691324cdaf202f5b1aae0829e7d.camel@redhat.com> <20230301030123.A0A2B20438@pchp3.se.axis.com> User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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: On Wed, 2023-03-01 at 04:01 +0100, Hans-Peter Nilsson wrote: > > From: David Malcolm > > Date: Tue, 28 Feb 2023 21:25:34 -0500 >=20 > > On Wed, 2023-03-01 at 01:59 +0100, Hans-Peter Nilsson wrote: > > > > From: David Malcolm > > > > Date: Tue, 28 Feb 2023 14:12:47 -0500 > > >=20 > > > > On Tue, 2023-02-28 at 19:47 +0100, Hans-Peter Nilsson wrote: > > > > > Ok to commit? > > > > > -- >8 -- > > > > > Investigating analyzer tesstsuite errors for cris-elf.=C2=A0 The > > > > > same > > > > > are > > > > > seen for pru-elf according to posts to gcc-testresults@. > > > > >=20 > > > > > For glibc, errno is #defined as: > > > > > =C2=A0extern int *__errno_location (void) __THROW > > > > > __attribute_const__; > > > > > =C2=A0# define errno (*__errno_location ()) > > > > > while for newlib in its default configuration, it's: > > > > > =C2=A0#define errno (*__errno()) > > > > > =C2=A0extern int *__errno (void); > > > >=20 > > > > We're already handling ___errno (three underscores) for Solaris > > > > as > > > > of > > > > 7c9717fcb5cf94ce1e7ef5c903058adf9980ff28; does it fix the issue > > > > if > > > > you=20 > > > > add __errno (two underscores) to analyzer/kf.cc's=20 > > > > register_known_functions in an analogous way to that commit?=C2=A0 > > > > (i.e. > > > > wiring it up to kf_errno_location, "teaching" the analyzer that > > > > that > > > > function returns a pointer to the "errno region") > > >=20 > > > But...there's already "support" for two underscores since > > > the commit you quote, so I guess not.=C2=A0=20 > >=20 > > Is there?=C2=A0 That commit adds support for: > > =C2=A0 __error > > but not for: > > =C2=A0 __errno > > unless there's something I'm missing. >=20 > No, it's me.=C2=A0 Apparently I can't spot the difference between > error and errno.=C2=A0 Sorry. >=20 > It's nice to know that the const-attribute (to signal that > the pointer points to a constant location) works > automatically, i.e. the Solaris and glibc definitions should > not (no longer?) be needed - unless there's other > errno-analyzing magic elsewhere too.=C2=A0=C2=A0 With the const-attribute, the analyzer "knows" that the pointer it gets back always points to the same thing, but it doesn't know what it points to, and so has to assume that any writes to errno could modify anything that has escaped. Also, the analyzer uses region_model::set_errno in various known_function implementations, e.g. for functions that can succeed or fail, to set errno on the "failure" execution path to a new symbolic value that tests as > 0. > Either way, since > there's specific support for this errno kind of thing, that > certainly works for me.=C2=A0 The patch gets smaller too. :) :) >=20 > So, how's this instead, pending full testing (only > analyzer.exp spot-tested)? Looks good, though how about adding a mention of newlib to the comment immediately above (the one that talks about Solaris and OS X)? Thanks for fixing this Dave