[PATCH] D150891: [Clang] precommit test

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 11:14:22 PDT 2023


nickdesaulniers created this revision.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add test case demonstrating issue.

Link: https://github.com/llvm/llvm-project/issues/62789


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150891

Files:
  clang/test/CodeGen/object-size.c


Index: clang/test/CodeGen/object-size.c
===================================================================
--- clang/test/CodeGen/object-size.c
+++ clang/test/CodeGen/object-size.c
@@ -525,6 +525,18 @@
   gi = OBJECT_SIZE_BUILTIN(&dsv[9].snd[0], 1);
 }
 
+// CHECK-LABEL: @test32
+static struct DynStructVar D = {
+  .fst = {},
+  .snd = { 0, 1, 2, },
+};
+unsigned long test32(void) {
+  // FIXME: GCC returns the sizeof the base type, plus the number of bytes from
+  // members of the initializer of the flexible array: 19.
+  // CHECK: ret i64 16
+  return __builtin_object_size(&D, 1);
+}
+
 // CHECK-LABEL: @PR30346
 void PR30346(void) {
   struct sa_family_t {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150891.523459.patch
Type: text/x-patch
Size: 671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230518/f8c6d9b9/attachment.bin>


More information about the cfe-commits mailing list