Skip to content

Union { 0 } initializer is no longer clean in GCC 15 #4640

@XeniaLu

Description

@XeniaLu

GCC: https://gcc.gnu.org/gcc-15/changes.html:

{0} initializer in C or C++ for unions no longer guarantees clearing of the whole union (except for static storage duration initialization), it just initializes the first union member to zero. If initialization of the whole union including padding bits is desirable, use {} (valid in C23 or C++) or use -fzero-init-padding-bits=unions option to restore old GCC behavior.

This is critical for WASMValue whose first member is int32_t, but obviously it has larger members.

Discussions: https://news.ycombinator.com/item?id=43792948

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions