Hi Pascal, You are right: the test case is undefined. The 2nd approach you provided, which makes random programs more interesting, was implemented in Csmith. However a bug at generation time caused the undefined test case. I have already fix the bug in a later revision. Please verify. -Xuejun From: csmith-dev-bounces@flux.utah.edu [mailto:csmith-dev-bounces@flux.utah.edu] On Behalf Of Pascal Cuoq
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 |