This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Implement no_sanitize function attribute

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>
baz(T *a)
main(int argc, char **argv)
  baz<int> (0);
  baz<char> (0);
  baz<char *> (0);

all 3 fn instances do share the same attribute list.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]