efriedma added a reviewer: rsmith. efriedma added a comment. I didn't think of this earlier, but strictly speaking, I think "(char*)nullptr+0" isn't undefined in C++? But probably worth emitting the warning anyway; anyone writing out arithmetic on null is probably doing something suspicious, even if it isn't technically undefined.
================ Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6032 +def ext_gnu_null_ptr_arith : Extension< + "inttoptr casting using arithmetic on a null pointer is a GNU extension">, + InGroup<PointerArith>; ---------------- The keyword "inttoptr" is part of LLVM, not something we expect users to understand. ================ Comment at: lib/Sema/SemaExpr.cpp:8808 + Context.getTypeSize(pointerType) == + Context.getTypeSize(IExp->getType())) + IsGNUIdiom = true; ---------------- Please make sure you use exactly the same check in Sema and CodeGen (probably easiest to stick a helper into lib/AST/). https://reviews.llvm.org/D37042 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits