This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Pre-commit testcase for PR55442
ClosedPublic

Authored by kito-cheng on Jun 2 2022, 2:04 AM.

Details

Summary

The testcase show the stack pointer isn't recovered when we got
exception from _Z3fooiiiiiiiiiiPi, and then we screw up due to
restore return address from wrong stack pointer.

NOTE: Trigger conditions: 1. Frame pointer is required. 2. Stack has out-going argument 3. Vector extension is enabled.

Another run-able testcase:

$ clang++ -target riscv64-unknown-linux-gnu -march=rv64gcv test.cpp

void __attribute__((noinline)) foo(int, int, int, int, int, int, int, int, int, int, int *){
 throw int(0);
}

int main(int argc, char **argv) {
  int exception_value = 1;
  try {
      foo(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  } catch (int i) {
    exception_value = i;
  }
  return exception_value;
}

Diff Detail

Event Timeline

kito-cheng created this revision.Jun 2 2022, 2:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 2:04 AM
kito-cheng requested review of this revision.Jun 2 2022, 2:04 AM
This revision is now accepted and ready to land.Jun 8 2022, 11:14 PM
This revision was landed with ongoing or failed builds.Jun 9 2022, 8:35 AM
This revision was automatically updated to reflect the committed changes.