vsk added a comment.

In https://reviews.llvm.org/D29437#664379, @regehr wrote:

> Does this check need to be sensitive to the dialect of C/C++ that the user 
> asked for? I know that it used to be the case that the standard could be read 
> either way for this case, but as you observe it is now unambiguously UB.


No, I don't think the check should be sensitive to language dialect.

You're right about the C99 spec not being very explicit about what 'a % b' 
means if 'a / b' is not representable. It's simply the "remainder" of 'a / b'. 
However, clang treats 'INT_MIN % -1' as having UB in C99 mode (rightly, imho), 
so it'd be nice to have a diagnostic for it.


https://reviews.llvm.org/D29437



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

Reply via email to