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);