================
@@ -815,3 +815,29 @@ void test_var() {
}
} // namespace templates
+
+namespace muliple_read_volatile {
+ volatile int v1;
+
+ void PositiveTest(){
+ int x = 0;
+ int y = 0;
+ x = v1 + v1; // cxx11-warning {{unsequenced accesses to volatile
qualified 'v1'}}
+ // cxx17-warning@-1 {{unsequenced accesses to volatile
qualified 'v1'}}
+ v1 = v1 * v1; // cxx11-warning {{unsequenced accesses to volatile
qualified 'v1'}}
+ // cxx17-warning@-1 {{unsequenced accesses to volatile
qualified 'v1'}}
+ x = v1 + (y++, v1); // cxx11-warning {{unsequenced accesses to volatile
qualified 'v1'}}
+ // cxx17-warning@-1 {{unsequenced accesses to volatile
qualified 'v1'}}
+ x = v1 + v1 || y; // cxx11-warning {{unsequenced accesses to volatile
qualified 'v1'}}
+ // cxx17-warning@-1 {{unsequenced accesses to volatile
qualified 'v1'}}
+ }
+
+ void NegativeTest(){
+ int x = 0;
+ int y = 0;
+ x = v1 + y; // no-warning
+ v1 = v1 * y; // no-warning
+ x = (v1, v1); // no-warning
+ x = v1 || v1; // no-warning
+ }
+} // namespace muliple_read_volatile
----------------
Seraphimt wrote:
@Fznamznon I do some research on builtin. And if I understood correct, in some
cases violation sequence exists.
It seems like ok for PowerPC\builtins-ppc-fma.c test, there arguments order -
left to right:
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/TargetBuiltins/PPC.cpp#L844
But, for tests of SystemZ, as far as I understood , violation sequence exists.
Example, in
https://github.com/llvm/llvm-project/blob/main/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c#L146
```c++
volatile vector float vf;
vf = vec_sel(vf, vf, vui);
```
Judging by vecintrin.h it emits into binary expr:
```c++
#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
static inline __ATTRS_o_ai __vector signed char
vec_sel(__vector signed char __a, __vector signed char __b,
__vector __bool char __c) {
return (((__vector signed char)__c & __b) |
(~(__vector signed char)__c & __a));
}
```
i.e. something like
```c++
volatile vector float vf;
vf = (vui & vf) | (~vui & vf)
```
@uweigand please, advise as creator of that test case.
https://github.com/llvm/llvm-project/pull/180955
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits