[PATCH] D143300: [randstruct] Don't allow implicit forward decl to stop struct randomization
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 6 11:57:54 PST 2023
MaskRay added inline comments.
================
Comment at: clang/test/CodeGen/init-randomized-struct-fwd-decl.c:2
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux -emit-llvm -frandomize-layout-seed=1234567890abcdef < %s | FileCheck %s
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux -emit-llvm -frandomize-layout-seed=1234567890abcdef -DFORWARD_DECL < %s | FileCheck -check-prefix=FWD-DECL %s
+// PR60349
----------------
void wrote:
> nickdesaulniers wrote:
> > Is the second check prefix necessary? The check lines look the same to me, unless I'm missing something.
> >
> > Removing it should let us also drop the redundant FWD-DECL lines below.
> It's there to check that the randomization doesn't change if the forward decl is outside of the structure. However, Windows yet again uses a different algorithm than Linux and generates a different randomized ordering. It's annoying. I can remove this check.
Instead of having two RUN lines, you may write both declarations (one using forard-decl, the other doesn't) in the source code. It decreases the number of clang invocations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143300/new/
https://reviews.llvm.org/D143300
More information about the cfe-commits
mailing list