Skip to content

Commit 6f858a2

Browse files
committed
Add missing cast to fix another issue caused by opaque pointers
1 parent e74bc51 commit 6f858a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/builder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
919919
self.context.new_bitcast(None, result, ptr_type)
920920
}
921921

922-
fn inbounds_gep(&mut self, _typ: Type<'gcc>, ptr: RValue<'gcc>, indices: &[RValue<'gcc>]) -> RValue<'gcc> {
922+
fn inbounds_gep(&mut self, typ: Type<'gcc>, ptr: RValue<'gcc>, indices: &[RValue<'gcc>]) -> RValue<'gcc> {
923+
// NOTE: due to opaque pointers now being used, we need to cast here.
924+
let ptr = self.context.new_cast(None, ptr, typ.make_pointer());
923925
// NOTE: array indexing is always considered in bounds in GCC (TODO(antoyo): to be verified).
924926
let mut indices = indices.into_iter();
925927
let index = indices.next().expect("first index in inbounds_gep");

0 commit comments

Comments
 (0)