[llvm-commits] [llvm-gcc-4.2] r47655 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Duncan Sands baldrick at free.fr
Wed Feb 27 10:12:42 PST 2008


Hi Dale,

> ConvertUnion does in fact look at the type of bitfields;

right, and that's a mistake right there it seems to me.  I'm pretty
sure that ConvertRECORD doesn't have this problem (which in that case
would be a Darwin BOOL going off the end of the struct).  Why not?
Because it only uses DECL_SIZE and never TYPE_SIZE, and though it
does look at types for bitfields it only does so in a mild way.

> I didn't   
> introduce this.  In all other cases I've seen, gcc has already done  
> the reduction to i8 etc. that you're talking about, so in general this  
> works.  The problem here is that the type of the bitfield is bigger  
> than the type of the union; that is due to Darwin ppc32's bizarre  
> choice of representation for bool, and I don't think it can happen  
> otherwise.

I think ConvertUNION should take the same approach as ConvertRECORD
(only it's much simpler in this case): it makes sense to have them
work and be designed in the same way as much as possible [*].

Ciao,

Duncan.

[*] In order to handle Fortran equivalence, they need to be merged
anyway, so I have a vested interest in seeing the logic converge
rather than diverge.



More information about the llvm-commits mailing list