[LLVMdev] Seeing a crash with ConstantFP::get

Neil Booth neil at daikokuya.co.uk
Thu Sep 6 08:17:39 PDT 2007


Dale Johannesen wrote:-

> You might argue with that one if you didn't feel like changing your
> compiler, but 9 .6p4 is quite explicit:
> 
> ... If the value of an enumerator is stored into a bitfield
> of the same enumeration type and the number of bits in the bitfield
> is large enough to hold all the values of that enumeration type, the
> original enumerator value and the value of the bitfield
> shall compare equal. [Example:
> enum BOOL { f=0, t=1 };
> struct A {
> BOOL b:1;
> };
> A a;
> void f() {
> a.b = t;
> if (a.b == t) // shall yield true
> { /* ... */ }
> }
> ?end example]
> 
> Looks just like your code.

Good job finding that, thanks. :)
 
> > It would be pretty sad indeed if
> > assigning an enum of that type to the bitfield didn't then compare
> > equal to itself :)
> 
> I agree.  So did the committee.

One they got right then :)

Neil.



More information about the llvm-dev mailing list