Issue 60931
Summary Clang 8 / C18 too strict warning about "multiple unsequenced modifications"?
Labels new issue
Assignees
Reporter nomennescio
    Clang 8 / C18 warns about the following code snippet:
```
int d;
int cmp (int *a, int *b) { return d*(*a-*b); }
...
int P[n],O[n],b=f (n,(qsort (memcpy (P,p,n*I),n,I,(d=1,cmp)),P),(qsort (memcpy (O,o,n*I),n,I,(d=-1,cmp)),O));
```
with the following warning:
```
solution.c:13:57: warning: multiple unsequenced modifications to 'd' [-Wunsequenced]
```

However, a sequence point exists between passing arguments to a function, and returning from that function, and one exists in evaluation of the expressions that have comma expressions. So yes, the order of evaluating the arguments to `f` is not determined, but the modifications to `d` are accurately sequenced in their semantics. Isn't the warning too strict? Or otherwise said, can any hints be given that `d` is only used in `cmp` with no consequence of the undetermined evaluation of `f`?

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to