Kernel launch failed with error "an illegal memory access was encountered" in [cudaLaunchCooperativeKernel]

I am a very beginner in CUDA. Recently, I tried to test the feature [cudaLaunchCooperativeKernel]. When I wanted to access the argument I passed into the kernel, it turned out that the error [kernel launch failed with error "an illegal memory access was encountered"] happened.
I have tested to access the data in the normal kernel launching method(launched as the commented instruction), which executed normally. Does anything I misconfigure?
Thanks for anyone’s help!!!

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <stdio.h>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <cooperative_groups.h>

using namespace std;
using namespace cooperative_groups;
namespace cg = cooperative_groups;

__global__ void test(int* i){
    printf("%d", *i);

int main(){
    int *i;
    cudaMallocManaged(&i, 4);
    *i = 5;
    void *kArgs[] = {i};

    auto a = cudaLaunchCooperativeKernel((void*)(test), 1, 1, kArgs) ;
    cudaError_t cudaerr = cudaDeviceSynchronize();
    if (cudaerr != cudaSuccess)
        printf("kernel launch failed with error \"%s\".\n",

Run your application with the compute-sanitizer tool, you should get this error:

========= Invalid __global__ read of size 4 bytes
=========     at 0x210 in /home/cuda/temp/ *)
=========     by thread (0,0,0) in block (0,0,0)
=========     Address 0x5 is misaligned

As you can see, the value of i is 5 instead of a pointer value. This is due to kArgs needing an additional level of pointer indirection:

    void *kArgs[] = {&i};