[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] Unions, bitfields, and reading bits that have not been initialized



 
and that
member is a 58-bit bitfield.

I have just realized that the program I was actually
analyzing did not use 58 as size for the bitfield, because
of the macro _CSMITH_BITFIELD expanding to
something equivalent to 58 % 32. The problem was there
nevertheless, only with different bitfield sizes.

This means that portably changing the behavior described in
this thread would require a bit of caution.

Using memset() to initialize all local union variables would mean
taking their addresses, and would probably disable many
of the compiler's optimizations for these variables.
This would limit Csmith's usefulness.

An alternative that comes to mind is to read only from
members that have been written to in the variable's past
(even if the member being read from was not the last
member used for writing).

Pascal