Skip to content

Clang generates invalid code and leaks resource when throwing an exception after return statement #75940

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

Closed
CurTInq opened this issue Dec 19, 2023 · 2 comments
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. duplicate Resolved as duplicate

Comments

@CurTInq
Copy link

CurTInq commented Dec 19, 2023

To be fair, all the other major compilers (gcc and msvc) also generate incorrect code according to the C++ standard, however clang also produces memory leak (destructor for returned object was never called).
It seems like something similar being reported in #61900 but in context of coroutines, while it seems to be a more common case.

Minimal reproducible example (I literally took it from the C++ standard): https://godbolt.org/z/Wvfz4jPW7

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Dec 19, 2023
@EugeneZelenko EugeneZelenko added clang:codegen IR generation bugs: mangling, exceptions, etc. and removed clang Clang issues not falling into any other category labels Dec 19, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2023

@llvm/issue-subscribers-clang-codegen

Author: None (CurTInq)

To be fair, all the other major compilers (gcc and msvc) also generate incorrect code according to the C++ standard, however clang also produces memory leak (destructor for returned object was never called). It seems like something similar being reported in #61900 but in context of coroutines, while it seems to be a more common case.

Minimal reproducible example (I literally took it from [the C++ standard](https://timsong-cpp.github.io/cppwp/n4659/except.ctor#2)): https://godbolt.org/z/Wvfz4jPW7

@shafik
Copy link
Collaborator

shafik commented Dec 19, 2023

Duplicate of: #12658

@shafik shafik closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
@shafik shafik added the duplicate Resolved as duplicate label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants