diff --git a/clang/test/CodeGen/object-size.c b/clang/test/CodeGen/object-size.c --- a/clang/test/CodeGen/object-size.c +++ b/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 {};