Author: rjmccall Date: Thu Dec 1 17:51:30 2016 New Revision: 288440 URL: http://llvm.org/viewvc/llvm-project?rev=288440&view=rev Log: Struct GEPs must use i32, not whatever size_t is. It should be safe to do this unconditionally, given that the indices will always be small constant integers anyway.
Modified: cfe/trunk/lib/CodeGen/ConstantBuilder.h Modified: cfe/trunk/lib/CodeGen/ConstantBuilder.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ConstantBuilder.h?rev=288440&r1=288439&r2=288440&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/ConstantBuilder.h (original) +++ cfe/trunk/lib/CodeGen/ConstantBuilder.h Thu Dec 1 17:51:30 2016 @@ -248,11 +248,13 @@ public: // Otherwise, add an index to drill into the first level of pointer. } else { assert(indices.empty()); - indices.push_back(llvm::ConstantInt::get(Builder.CGM.SizeTy, 0)); + indices.push_back(llvm::ConstantInt::get(Builder.CGM.Int32Ty, 0)); } assert(position >= Begin); - indices.push_back(llvm::ConstantInt::get(Builder.CGM.SizeTy, + // We have to use i32 here because struct GEPs demand i32 indices. + // It's rather unlikely to matter in practice. + indices.push_back(llvm::ConstantInt::get(Builder.CGM.Int32Ty, position - Begin)); } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits