Skip to content

randomize auto-layout field order in debug mode #4336

@fengb

Description

@fengb

Idea mostly stolen inspired from Go where iterating map is explicitly randomized by the compiler. This was introduced to prevent people from accidentally depending on order in testing which causes hard-to-reproduce bugs in prod.

Can we apply the same idea for things like struct memory layout? It is documented to be explicitly undefined but the memory is actually static and manually doing byte casting probably will consistently work right now, but it's almost guaranteed to break in the near future.

If we force randomization, it'll expose these bugs earlier and hopefully point towards the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions