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

[csmith-dev] Unions with const and non const members


csmith creates unions with a mix of const and non const members, eg:

union U0 {
   int64_t  f0;
   const uint8_t  f1;
   uint64_t  f2;

static union U0 g_627 = {0x34L};

I'm chasing down a failing testcase on a vendor compiler where csmith
updates the non const members and then reads the const member. I don't
think that is valid c.

Unlike gcc, the vendor compiler propagates the constant 0x34 to all uses
of g_627.f1, such that it will never see a change if we write to the
other members.