[PATCH] D121556: [randstruct] Add randomize structure layout support
Bill Wendling via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 11 15:28:19 PDT 2022
void added inline comments.
================
Comment at: clang/unittests/AST/RandstructTest.cpp:154-158
+#ifdef _WIN32
+ const field_names Expected = {"lettuce", "bacon", "mayonnaise", "tomato"};
+#else
+ const field_names Expected = {"mayonnaise", "bacon", "tomato", "lettuce"};
+#endif
----------------
jyknight wrote:
> aaron.ballman wrote:
> > void wrote:
> > > aaron.ballman wrote:
> > > > Any idea what's gone wrong here? (Do we have a bug to file because these come out reversed? If so, can you add a FIXME comment here that we expect this test to change someday?)
> > > I think it's just a case where Windows' algorithm for `std::mt19937` is subtly different than the one for Linux. I'm not sure we should worry about it too much, to be honest. As long as it produces a deterministic output on the same platform we should be fine. I think it's expected that the same compiler/environment is used during all compilation steps. (I.e., one's not going to compile a module on Windows for a kernel build on Linux.)
> > Okay, that's a great reason for this to be left alone.
> I do think that as an //ideal//, a compile run on one host platform ought to produce the exact same output as a compile run on another (presuming a triple and sysroot are provided, and mumblemumble file-paths).
>
> But I have no idea how close or far we currently are from such an ideal.
I completely agree. Alternatively, we could use some other RNG-type algorithm that will be the same across platforms.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121556/new/
https://reviews.llvm.org/D121556
More information about the cfe-commits
mailing list