diff options
| author | Thorsten Schuett <schuett@gmail.com> | 2020-08-04 11:10:01 -0700 |
|---|---|---|
| committer | JF Bastien <jfbastien@apple.com> | 2020-08-04 11:10:29 -0700 |
| commit | e18c6ef6b41a59af73bf5c3d7d52a8c53a471e5d (patch) | |
| tree | ab9bd7b9e60b9754339fae7e312e6a98af1c9ca5 /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | |
| parent | 31ec6e969d601eb4fbee7bd4be3d03d23b5b3c11 (diff) | |
[clang] improve diagnostics for misaligned and large atomics
"Listing the alignment and access size (== expected alignment) in the warning
seems like a good idea."
solves PR 46947
struct Foo {
struct Bar {
void * a;
void * b;
};
Bar bar;
};
struct ThirtyTwo {
struct Large {
void * a;
void * b;
void * c;
void * d;
};
Large bar;
};
void braz(Foo *foo, ThirtyTwo *braz) {
Foo::Bar bar;
__atomic_load(&foo->bar, &bar, __ATOMIC_RELAXED);
ThirtyTwo::Large foobar;
__atomic_load(&braz->bar, &foobar, __ATOMIC_RELAXED);
}
repro.cpp:21:3: warning: misaligned atomic operation may incur significant performance penalty; the expected (16 bytes) exceeds the actual alignment (8 bytes) [-Watomic-alignment]
__atomic_load(&foo->bar, &bar, __ATOMIC_RELAXED);
^
repro.cpp:24:3: warning: misaligned atomic operation may incur significant performance penalty; the expected (32 bytes) exceeds the actual alignment (8 bytes) [-Watomic-alignment]
__atomic_load(&braz->bar, &foobar, __ATOMIC_RELAXED);
^
repro.cpp:24:3: warning: large atomic operation may incur significant performance penalty; the access size (32 bytes) exceeds the max lock-free size (16 bytes) [-Watomic-alignment]
3 warnings generated.
Differential Revision: https://reviews.llvm.org/D85102
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
0 files changed, 0 insertions, 0 deletions
