https://bugs.llvm.org/show_bug.cgi?id=48236

            Bug ID: 48236
           Summary: dereferencing __attribute__((noderef)) should not warn
                    inside sizeof() expressions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: ja...@google.com
          Reporter: ja...@google.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

The purpose of __attribute__((noderef)) is to warn about code that will cause
memory to be dereferenced. Currently, clang also warns about code such as:

```
void copy_from_user(void *dst, void __attribute__((noderef)) *src, unsigned
long len);

struct foo {
  int a;
  int b;
};

int test_false_positive_deref(struct foo __attribute__((noderef)) *user_foo) {
  struct foo local_foo;
  copy_from_user(&local_foo, user_foo, sizeof(*user_foo));
  return local_foo.a + local_foo.b;
}
```

noderef checks should be suppressed if isUnevaluatedContext().

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to