plctlab / plct-spike

Spike, a RISC-V ISA Simulator
Other
9 stars 4 forks source link

Segmentation fault when `pop` #8

Closed Xinlong-Wu closed 2 years ago

Xinlong-Wu commented 2 years ago

I have mat a Segmentation fault error when run an progrem compiled by Clang.

Clang Verision:

Repo: plctlab/llvm-project Branch: riscv-zce-llvm14 Commit: ab680c08bc0e2a6705e85f80f27b6efc080521e3

Spike Verision:

Repo: plctlab/plct-spike/ Branch: plct-zce-dev Commit: 7f3e9e9165a8de35523c56737c1a12444ddd30d0

Progrem Sorece code

int test(){
    int c = 63;
    int a = 6;
    int b = a * c * 30;
    return b;
}

int main(int argc, char const *argv[])
{
    char x=-1;
    int a = 1;
    int b = 2;
    int result = test();
    return 0;
}

Command Line

clang --target=riscv64 -march=rv64imac -mzce-push-pop --gcc-toolchain=$HOME/opt/riscv -fuse-ld=lld hello.c spike -l --isa=rv64imaczce $(which pk) a.out

the log of spike shows that spike Segmentation fault after dumping instruction pop {ra, s0}, {}, 32 (seems this code is epilog of founction test())

relative files is here: spike#8

liweiwei90 commented 2 years ago

RA register is pushed or poped twice time in previous implementation. I have fixed it. You can try again.