Hi Clang-users!

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!

Sam
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to