GCC is making type-inconsistent trees when forming globals with
pointers to methods in them. This handles it.
-Chris
Index: llvm-convert.cpp
===================================================================
--- llvm-convert.cpp (revision 122082)
+++ llvm-convert.cpp (working copy)
@@ -4415,6 +4415,11 @@
const Type *Ty = ConvertType(TREE_TYPE(exp));
bool EltIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0)));
bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
+
+ // If this is a structure-to-structure cast, just return the uncasted value.
+ if (!Elt->getType()->isFirstClassType() || !Ty->isFirstClassType())
+ return Elt;
+
// Elt and Ty can be integer, float or pointer here: need generalized cast
Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned,
Ty, TyIsSigned);
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits