Issue 56008
Summary [RISCV] Stack space ins't de-allocate immediately might cause stack overflow
Labels backend:RISC-V
Assignees
Reporter kito-cheng
    In this https://reviews.llvm.org/D126861 patch we try to fixed a mis-compile for a run-time failed https://github.com/llvm/llvm-project/issues/55442 , however there still another issue: the stack isn't de-allocate after exception handling immediately, that might cause stack overflow the exception is happened within a loop:  

Reduced case: 
```
void foo(int, int, int, int, int, int, int, int, int, int);

bool check_frame_variant(int n) {
  int exception_value = 1;
  int j;
  for (j=0;j < n;j++) {
    try {
        // Allocate stack for out-going argument
        foo(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        // De-allocate stack for out-going argument, that won't release if we go exception from foo.
    } catch (int i) {
      exception_value += i;
    }
  }
  // Restore sp from fp
  return exception_value;
}

``` 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to