Skip to content

Commit 03020c4

Browse files
committed
Fix gep on pointers to non-number
1 parent f3b82df commit 03020c4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
922922
// require dereferencing the pointer.
923923
for index in indices {
924924
pointee_type = pointee_type.get_pointee().expect("pointee type");
925-
let pointee_size = self.context.new_rvalue_from_int(index.get_type(), pointee_type.get_size() as i32);
925+
let size = self.cx.context.new_sizeof(pointee_type);
926+
let pointee_size = self.context.new_cast(None, size, index.get_type());
926927
result = result + self.gcc_int_cast(*index * pointee_size, self.sizet_type);
927928
}
928929
self.context.new_bitcast(None, result, ptr_type)

0 commit comments

Comments
 (0)