[PATCH] D123763: [randstruct] Enforce using a designated init for a randomized struct

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 15 10:22:32 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/Sema/init-randomized-struct.c:30
+} __attribute__((randomize_layout));
+
+struct other_test t5 = { .a = foo, .b[0] = foo }; // Okay
----------------
MaskRay wrote:
> Perhaps test an empty struct with randomize_layout and a struct with one field with randomize_layout?
Good point -- there's really no reason to reject something like:
```
struct degenerate {
  func_ptr a;
};

struct degenerate d= { foo };
```
even though it's not doing a zero initialization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123763



More information about the cfe-commits mailing list