From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105791 invoked by alias); 21 Nov 2019 22:39:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 105782 invoked by uid 89); 21 Nov 2019 22:39:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Nov 2019 22:39:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574375943; 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:openpgp:openpgp:autocrypt:autocrypt; bh=NBnRx89uG98FlrTc52BSYAGC77xTdyx7roY8KImrxxY=; b=RLOmBAITo+Zm9ZZhN+at+j3y9ykByXfDV5EpfRiA93jYs62J7sOm8sGZszrUzyr4y9DWZg zyW7MismVXzR+QPeIihn2YQh6/hfviypbg+JAm2aCCQyBPu+gjbm61UsGOB0Nt51yv5lAY vrEq3OGomD7OX6Nshc3Pl0LddNhyuJg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-aU0ZFOS-Nc2nZ4Oz6yaP2A-1; Thu, 21 Nov 2019 17:39:01 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C33B107ACC4; Thu, 21 Nov 2019 22:39:00 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-16.rdu2.redhat.com [10.10.112.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53CEE5E263; Thu, 21 Nov 2019 22:38:59 +0000 (UTC) Subject: Re: [PATCH v3] add object access attributes (PR 83859) To: Martin Sebor , Richard Biener Cc: gcc-patches References: <056e2b5b-696c-ca69-9027-7d2369354b07@gmail.com> <3b148654-b12c-1e7c-32d2-78df9d6c70e7@gmail.com> <2d4cec52-3afa-227f-9f1d-e82b948003f9@gmail.com> <96a09235-ad6e-4ee4-8a7e-ac3fee688171@gmail.com> From: Jeff Law Openpgp: preference=signencrypt Message-ID: <07fde605-8a8e-b49e-793e-7fd92c569391@redhat.com> Date: Thu, 21 Nov 2019 22:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <96a09235-ad6e-4ee4-8a7e-ac3fee688171@gmail.com> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg02158.txt.bz2 On 11/21/19 10:11 AM, Martin Sebor wrote: > Attached=C2=A0is=C2=A0another=C2=A0revision=C2=A0of=C2=A0this=C2=A0enhanc= ement,=C2=A0this=C2=A0one > incorporating=C2=A0Richard's=C2=A0request=C2=A0for=C2=A0a=C2=A0more=C2=A0= efficient=C2=A0encoding > of=C2=A0the=C2=A0attributes=C2=A0to=C2=A0enable=C2=A0faster=C2=A0parsing.= =C2=A0=C2=A0There=C2=A0is=C2=A0just=C2=A0one > attribute=C2=A0called=C2=A0access,=C2=A0with=C2=A0the=C2=A0rest=C2=A0bein= g=C2=A0arguments.=C2=A0=C2=A0This > is=C2=A0transformed=C2=A0to=C2=A0access=C2=A0(mode-string)=C2=A0where=C2= =A0the=C2=A0mode-string > is=C2=A0a=C2=A0STRING_CST=C2=A0describing=C2=A0the=C2=A0access=C2=A0mode= =C2=A0(read/write/both) > and=C2=A0the=C2=A0two=C2=A0positional=C2=A0arguments=C2=A0for=C2=A0the=C2= =A0function=C2=A0type. >=20 > I=C2=A0have=C2=A0also=C2=A0removed=C2=A0the=C2=A0attributes=C2=A0from=C2= =A0the=C2=A0built-in=C2=A0functions > since=C2=A0they're=C2=A0not=C2=A0used=C2=A0for=C2=A0anything=C2=A0yet,=C2= =A0and=C2=A0added=C2=A0more=C2=A0argument > validation. >=20 > To=C2=A0test=C2=A0this=C2=A0a=C2=A0little=C2=A0more=C2=A0extensively,=C2= =A0I=C2=A0annotated=C2=A0a=C2=A0few=C2=A0Glibc > =C2=A0functions=C2=A0with=C2=A0the=C2=A0new=C2=A0attribute=C2= =A0and=C2=A0rebuilt=C2=A0it=C2=A0and > its=C2=A0test=C2=A0suite.=C2=A0=C2=A0That=C2=A0exposed=C2=A0a=C2=A0proble= m=C2=A0with=C2=A0function=C2=A0pointers > not=C2=A0being=C2=A0handled=C2=A0correctly=C2=A0so=C2=A0I=C2=A0fixed=C2= =A0that=C2=A0by=C2=A0letting > the=C2=A0access=C2=A0attribute=C2=A0apply=C2=A0to=C2=A0function=C2=A0poin= ters=C2=A0(and=C2=A0function > pointer=C2=A0types=C2=A0in=C2=A0general). >=20 > When=C2=A0this=C2=A0is=C2=A0finalized,=C2=A0if=C2=A0there's=C2=A0time=C2= =A0I'm=C2=A0still=C2=A0hoping=C2=A0to=C2=A0get > back=C2=A0to=C2=A0the=C2=A0parts=C2=A0of=C2=A0the=C2=A0patch=C2=A0that=C2= =A0make=C2=A0use=C2=A0of=C2=A0the=C2=A0attribute > for=C2=A0-Wunused=C2=A0and=C2=A0-Wuninitialized=C2=A0that=C2=A0I=C2=A0rem= oved=C2=A0on=C2=A0Jeff's=C2=A0request > for=C2=A0smaller,=C2=A0independent=C2=A0changes. >=20 > In=C2=A0GCC=C2=A011=C2=A0I'd=C2=A0like=C2=A0to=C2=A0look=C2=A0into=C2=A0t= ying=C2=A0this=C2=A0attribute=C2=A0in=C2=A0with > _FORTIFY_SOURCE. >=20 > Martin >=20 > gcc-83859.diff >=20 > PR middle-end/83859 - attributes to associate pointer arguments and sizes >=20 > gcc/ChangeLog: >=20 > PR middle-end/83859 > * attribs.h (struct attr_access): New. > * attribs.c (decl_attributes): Add an informational note. > * builtins.c (check_access): Make extern. Consistently set no-warning > after issuing a warning. Handle calls through function pointers. Set > no-warning. > * builtins.h (check_access): Declare. > * calls.c (rdwr_access_hash): New type. > (rdwr_map): Same. > (init_attr_rdwr_indices): New function. > (maybe_warn_rdwr_sizes): Same. > (initialize_argument_information): Call init_attr_rdwr_indices. > Call maybe_warn_rdwr_sizes. > * doc/extend.texi (attribute access): Document new attribute. >=20 > gcc/c-family/ChangeLog: >=20 > PR middle-end/83859 > * c-attribs.c (handle_access_attribute): New function. > (c_common_attribute_table): Add new attribute. > (get_argument_type): New function. > (append_access_attrs): New function. > (get_nonnull_operand): Rename... > (get_attribute_operand): ...to this. > * c-common.c (get_nonnull_operand): Rename... > (get_attribute_operand): ...to this. >=20 > gcc/testsuite/ChangeLog: >=20 > PR middle-end/83859 > * c-c++-common/attr-nonstring-8.c: Adjust text of expected warning. > * gcc.dg/Wstringop-overflow-22.c: New test. > * gcc.dg/Wstringop-overflow-23.c: New test. > * gcc.dg/attr-access-read-only.c: New test. > * gcc.dg/attr-access-read-write.c: New test. > * gcc.dg/attr-access-read-write-2.c: New test. > * gcc.dg/attr-access-write-only.c: New test. >=20 > diff --git a/gcc/calls.c b/gcc/calls.c > index 62921351b11..15627abbd0d 100644 > --- a/gcc/calls.c > +++ b/gcc/calls.c > @@ -52,6 +52,8 @@ along with GCC; see the file COPYING3. If not see > #include "tree-ssa-strlen.h" > #include "intl.h" > #include "stringpool.h" > +#include "hash-map.h" > +#include "hash-traits.h" > #include "attribs.h" > #include "builtins.h" > #include "gimple-fold.h" > @@ -1258,6 +1260,9 @@ alloc_max_size (void) > bool > get_size_range (tree exp, tree range[2], bool allow_zero /* =3D false */) > { > + if (!exp) > + return false; > + > if (tree_fits_uhwi_p (exp)) > { > /* EXP is a constant. */ This change isn't mentioned anywhere in the ChangeLog. If its intentional, please mention it in the ChangeLog. If it's not intentional, then drop it :-) > diff --git a/gcc/gimple.h b/gcc/gimple.h > index 5a190b1714d..10223386d04 100644 > --- a/gcc/gimple.h > +++ b/gcc/gimple.h > @@ -24,6 +24,8 @@ along with GCC; see the file COPYING3. If not see >=20=20 > #include "tree-ssa-alias.h" > #include "gimple-expr.h" > +#include "function.h" > +#include "basic-block.h" I thought I asked before, can these be moved into the .c files where they're actually needed? Otherwise it looks OK to me. jeff