[cfe-users] C11, -Wunsequenced and aliasing
Archibald Samuel Elliott via cfe-users
cfe-users at lists.llvm.org
Wed Jul 26 16:38:40 PDT 2017
What are the expectations for the -Wunsequenced warning in Clang with C11?
My understanding was the following expression would be unsequenced according to the spec, but clang doesn't give me a warning:
((*p = 3) + (*q = 4))
Is clang only going to warn if it knows p and q definitely alias each other here?
I also tried the expression:
((*p = 3) + (*p = 4))
Which also gave no warnings, despite p aliasing itself.
Is the warning based on a heuristic of whether the unsequenced behaviour will be observable, or on whether the two assignments ever alias, or will it only warn if it knows two side-effecting expressions are definitely unsequenced?
Maybe this kind of analysis isn't for clang, and instead is for the clang static analyser.
Thank you in advance!
More information about the cfe-users