[PATCH] D83502: Change behavior with zero-sized static array extents

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 04:04:21 PDT 2020


aaron.ballman marked an inline comment as done.
aaron.ballman added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:2515
+                } else {
+                  AI->addAttr(llvm::Attribute::NonNull);
+                }
----------------
rjmccall wrote:
> Isn't the old logic still correct?  If the element size is static and the element count is positive, the argument is dereferenceable out to their product; otherwise it's nonnull if null is the zero value and we aren't semantically allowing that to be a valid pointer.
I was questioning this -- I didn't think the old logic was correct because it checks that the array is in address space 0, but the nonnull-ness should apply regardless of address space (I think). The point about valid null pointers still stands, though. Am I misunderstanding the intended address space behavior?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83502/new/

https://reviews.llvm.org/D83502





More information about the cfe-commits mailing list