[PATCH] D124694: [randstruct] Move initializer check to be more effective

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 06:15:18 PDT 2022


aaron.ballman added a comment.

  struct t {
     int a, b, c, d, e;
  } x = { .a = 2, 4, 5, 6 };

This situation seems like it should be an error, shouldn't it? The user specified one designated initializer (yay, that one is correct), but the rest are positional initializers and so there's no telling what they actually initialize due to field randomization.



================
Comment at: clang/test/Sema/init-randomized-struct.c:1
-// RUN: %clang_cc1 -triple=x86_64-unknown-linux -frandomize-layout-seed=1234567890abcdef \
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux -frandomize-layout-seed=1234567890abcded \
 // RUN:  -verify -fsyntax-only -Werror %s
----------------
Why is this change needed?

(Also, shouldn't there be other test coverage added to the file?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124694



More information about the cfe-commits mailing list