This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH v2] Implement no_sanitize function attribute
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 9 Jun 2017 14:12:57 +0200
- Subject: Re: [PATCH v2] Implement no_sanitize function attribute
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc1G6vsFQiGdreyrf9Vw+E0JuoQYGazXSrENaGzvhy+Ffirstname.lastname@example.org> <20170531115102.GU24023@tucnak> <CAFiYyc0iFrCCKS152LXzsksE=1ZrOLvWsm=ykX-0=A-SMuHUemail@example.com> <firstname.lastname@example.org> <CAFiYyc22nMjc=9L4bDRUs9aFqwcNqphhvQaCYyr+Uo7YcJzFxg@mail.gmail.com> <email@example.com> <CAFiYyc1Xd-jTFhBGw7H80PLcqbTbgnuhprCQyZgn-h9i9QmVbw@mail.gmail.com> <firstname.lastname@example.org> <20170608134715.GV2154@tucnak> <email@example.com> <20170609094203.GH2154@tucnak>
On 06/09/2017 11:42 AM, Jakub Jelinek wrote:
On Fri, Jun 09, 2017 at 11:29:06AM +0200, Martin Liška wrote:
Having that inlined would be great, however we'll need to put it to tree.h
and thus we have to include "options.h" before tree.h in multiple source files.
Doesn't that mean that tree.h is not the right header to put this into?
It has nothing to do with the stuff normally in tree.h.
We don't have a common sanitizer header, just asan.h (which already has
similar partially inline checks), ubsan.h and tsan.h, but perhaps putting it
into one of those would be certainly better than tree.h.
I'll do that, currently testing patch.
If there is a previous attribute already, can't you modify it in
place? If not, as it could be perhaps shared? with other functions
somehow, at least you should avoid adding a new attribute if
(old_value | flags) == old_value.
Yep, we should definitely share, I'll add test-case for that.
I was worried about stuff like templates, where a template has one
no_sanitize attribute and the implied "no sanitize flags", and then
you instantiate it or specialize it with extra attributes.
Are you sure it can't be ever shared between multiple functions?
For following example:
template <typename T>
main(int argc, char **argv)
baz<char *> (0);
all 3 fn instances do share the same attribute list.