jamieschmeiser added inline comments.
================ Comment at: clang/test/Sema/pointer-addition.c:34 + f = (char*)(f - (char*)0); // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}} + f = (char*)((char*)0 - (char*)0); // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}} expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}} } ---------------- efriedma wrote: > This is what I was afraid would happen. > > C++ has a specific carveout in the standard that "null-null" isn't undefined. > C doesn't, but I'm not sure warning is practically useful there. > > In any case, printing the same warning twice isn't useful. Yes, I see that [expr.add] p 7 says nullptr-nullptr is defined to be 0. I will suppress the warning for this. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98798/new/ https://reviews.llvm.org/D98798 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits