Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethrowing foreign exceptions #195

Open
purplesyringa opened this issue Oct 25, 2024 · 0 comments
Open

Rethrowing foreign exceptions #195

purplesyringa opened this issue Oct 25, 2024 · 0 comments

Comments

@purplesyringa
Copy link

The EH ABI seems to be internally inconsistent.

Section 1.2 reads:

The exception_cleanup routine is called whenever an exception object needs to be destroyed by a different runtime than the runtime which created the exception object, for instance if a Java exception is caught by a C++ catch handler. In such a case, a reason code (see above) indicates why the exception object needs to be deleted:

_URC_FOREIGN_EXCEPTION_CAUGHT = 1: This indicates that a different runtime caught this exception. Nested foreign exceptions, or rethrowing a foreign exception, result in undefined behaviour.

Section 1.6.4 reads:

Otherwise, a catch block catching a foreign exception is allowed:

  • to resume normal execution, thereby stopping propagation of the foreign exception and deleting it, or

  • to rethrow the foreign exception. In that case, the original exception object must be unaltered by the C++ runtime.

So is it allowed to rethrow a foreign exception or does that cause UB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant