On Tue, 19 Mar 2019, Michael Matz wrote: > Hi, > > On Tue, 19 Mar 2019, Richard Biener wrote: > > > It doesn't really. Consider the following IMHO valid testcase: > > > > enum X { A, B }; > > enum Y { C, D }; > > void foo (int *p) > > { > > *(enum X *)p = A; > > *(enum Y *)p = D; > > return *(enum X *)p; > > } > > > > int main() > > { > > int storage; > > if (foo (&storage) != A) > > (You want to require 'B' here, not 'A')
Eh, yes. Actually D I guess, or simply 1. > > abort (); > > } > > If you want the above testcase to be valid then yes, I agree, you have to > give all enums the same alias set as the underlying type. Meh, I don't > like it :-/ I think the C standard says the testcase should not abort. The patch still needs approval though. I'll make sure to add a testcase like the above. Richard.