[LLVMdev] Failed to catch exception across function calls
Ziqiang Patrick Huang
ziqiang.huang1001 at gmail.com
Tue May 5 07:10:20 PDT 2015
Dear LLVMers,
I'm working on the openrisc backend which is not currently upstreamed, I
want to use llvm as the compiler and linking with gcc/g++. I have a simple
test program below, right now if I run the compiled binary, it hangs and
never returned to the catch block. If I throw exception directly in the try
block instead of in another function, it works fine.
I've looked at the generated assembly instructions and they all look right
to me, except for the generated exception table which I don't know enough
to tell whether it's right or nor, my first guess is that maybe there is
some compatibility issue for the exception table between llvm and g++, so I
try to manually modify according to that generated by g++, but the bug is
still there.
I wonder how should I approach this issue, is there anything in the backend
that could cause the bug ?
I attached the assembly in case anyone wants to take a closer look.
Any suggestion is greatly appreciated.
Patrick
#include <stdlib.h>
#include <stdio.h>
void foo(int a) {
throw -15;
}
int main() {
int error = 0;
try {
foo(0);
}
catch (int e) {
error = e;
}
printf("Error = %d\n", error);
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150505/d45e4120/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: throw-llvm.s
Type: application/octet-stream
Size: 3267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150505/d45e4120/attachment.obj>
More information about the llvm-dev
mailing list