[PATCH] D67122: [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 12:54:06 PDT 2019
aaron.ballman added inline comments.
================
Comment at: clang/docs/ReleaseNotes.rst:63
+* As per C++ and C Standards (C++: ``[expr.add]``; C17: 6.5.6p8), applying
+ non-zero offset to ``nullptr`` (or making non-``nullptr`` a ``nullptr``,
----------------
rsmith wrote:
> In C, even adding 0 to a null pointer is undefined. Did this change in C17?
I don't see what words in the C standard make this UB. If it's UB-by-omission, I think it's unintentional. I mean, this language allows `&*some_null_pointer` without UB, so I would be really surprised if `some_null_ptr + 0` was UB. Do you have a source in the C standard for the UB?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67122/new/
https://reviews.llvm.org/D67122
More information about the llvm-commits
mailing list