================
@@ -397,6 +397,84 @@ void hint(void) {
a += 1;
}
+void gh107979(void) {
+ int x = 0, v = 0;
+#pragma omp atomic
+ // expected-error@+2 {{the statement for 'atomic' must be an expression
statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x
binop expr' or 'x = expr binop x', where x is an lvalue expression with scalar
type}}
+ // expected-note@+1 {{expected a valid expression}}
+ 0--; // expected-error {{expression is not assignable}}
+#pragma omp atomic
+ // expected-error@+2 {{the statement for 'atomic' must be an expression
statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x
binop expr' or 'x = expr binop x', where x is an lvalue expression with scalar
type}}
+ // expected-note@+1 {{expected a valid expression}}
+ --0; // expected-error {{expression is not assignable}}
+#pragma omp atomic
+ // expected-error@+2 {{the statement for 'atomic' must be an expression
statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x
binop expr' or 'x = expr binop x', where x is an lvalue expression with scalar
type}}
+ // expected-note@+1 {{expected a valid expression}}
+ 0++; // expected-error {{expression is not assignable}}
+#pragma omp atomic update
+ // expected-error@+2 {{the statement for 'atomic update' must be an
expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;',
'x = x binop expr' or 'x = expr binop x', where x is an lvalue expression with
scalar type}}
+ // expected-note@+1 {{expected a valid expression}}
+ 0 += 1; // expected-error {{expression is not assignable}}
----------------
ojhunt wrote:
Your initial fuzzer found failure was `0--` that is only one possible error,
you should consider others.
One of the most obvious problems is that I think you drop diagnostics after an
error has occurred:
```cpp
int x = 0, v = 0--;
#pragma omp atomic capture
{ x = v; v++; }
```
https://github.com/llvm/llvm-project/pull/228914
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits