https://bugs.llvm.org/show_bug.cgi?id=46947
Bug ID: 46947
Summary: Confusing misaligned atomic operation warning
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: schu...@gmail.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
For the following code, I get an error:
repro.cpp:13:3: warning: misaligned atomic operation may incur significant
performance penalty [-Watomic-alignment]
__atomic_load(&foo->bar, &dummy, __ATOMIC_RELAXED);
clang believes that the pointer is 8 byte aligned, but foo->bar is actually 16
byte aligned.
#include <cstdint>
struct Foo {
struct Bar {
uint64_t a;
uint64_t b;
};
Bar bar;
};
void braz(Foo *foo) {
Foo::Bar dummy;
__atomic_load(&foo->bar, &dummy, __ATOMIC_RELAXED);
}
--
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