https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125510

            Bug ID: 125510
           Summary: no_sanitize_address on member function fails to
                    prevent sanitization
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: services+gccbugs at vasama dot org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

This code reports a sanitizer failure despite the use of `no_sanitize_address`:

```
#include <sanitizer/asan_interface.h>

struct wrapper
{
    long long x;

    __attribute__((no_sanitize_address))
    long long get() const
    {
        return x;
    }
};

long long get_x(wrapper const& w)
{
    return w.get();
}

volatile long long y;

int main()
{
    wrapper w{y};
    __asan_poison_memory_region(&w, sizeof(w));
    long long l = get_x(w);
    __asan_unpoison_memory_region(&w, sizeof(w));
    return l;
}
```

Live reproducer on Compiler Explorer: https://godbolt.org/z/3fhdP1qWd
  • [Bug sanitizer/125510] New... services+gccbugs at vasama dot org via Gcc-bugs

Reply via email to