Fix for check_ptr_call for variadic functions

This commit is contained in:
Antoni Boucher 2023-06-17 13:19:41 -04:00
parent 8560b07ebf
commit 3d7ec5923d
2 changed files with 15 additions and 7 deletions

View File

@ -30,9 +30,10 @@ mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
# Since we can't override the sysroot for the UI tests anymore, we create a new toolchain and manually overwrite the sysroot directory.
rust_toolchain=$(cat ../rust-toolchain | grep channel | sed 's/channel = "\(.*\)"/\1/')
my_toolchain_dir=$HOME/.rustup/toolchains/codegen_gcc_ui_tests-$rust_toolchain-$TARGET_TRIPLE
rm -rf $my_toolchain_dir
cp -r $HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE $my_toolchain_dir
rm -rf $my_toolchain_dir/lib/rustlib/$TARGET_TRIPLE/
cp -r ../build_sysroot/sysroot/* $my_toolchain_dir
# TODO: to remove.
#rust_toolchain=$(cat ../rust-toolchain | grep channel | sed 's/channel = "\(.*\)"/\1/')
#my_toolchain_dir=$HOME/.rustup/toolchains/codegen_gcc_ui_tests-$rust_toolchain-$TARGET_TRIPLE
#rm -rf $my_toolchain_dir
#cp -r $HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE $my_toolchain_dir
#rm -rf $my_toolchain_dir/lib/rustlib/$TARGET_TRIPLE/
#cp -r ../build_sysroot/sysroot/* $my_toolchain_dir

View File

@ -181,6 +181,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
})
.collect();
debug_assert_eq!(casted_args.len(), args.len());
Cow::Owned(casted_args)
}
@ -207,7 +209,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let func_name = format!("{:?}", func_ptr);
let casted_args: Vec<_> = param_types
let mut casted_args: Vec<_> = param_types
.into_iter()
.zip(args.iter())
.enumerate()
@ -237,6 +239,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
})
.collect();
// NOTE: to take into account variadic functions.
for i in casted_args.len()..args.len() {
casted_args.push(args[i]);
}
Cow::Owned(casted_args)
}