This came up because the new df::job::job_spec union was not getting initialized on construction, even if init-value attributes were added to the fields.
This appears to be because the union is a mixture of plain data types (uint32_t) and bitfield types, which have non-default constructors. The end result is that no constructors get called and the resulting value is garbage.
This change zero-inits union structures. Existing code that does set the union fields will still work since the fields are set in the constructor for the containing class, which executes after the memset introduced here.
as per Discord discussion: https://discord.com/channels/793331351645323264/807444047215853578/1241770443371839488
This came up because the new df::job::job_spec union was not getting initialized on construction, even if
init-value
attributes were added to the fields.This appears to be because the union is a mixture of plain data types (uint32_t) and bitfield types, which have non-default constructors. The end result is that no constructors get called and the resulting value is garbage.
This change zero-inits union structures. Existing code that does set the union fields will still work since the fields are set in the constructor for the containing class, which executes after the memset introduced here.