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

Temporary's destructor not called when exception thrown in a called function when compiled with -O2 #14595

Closed
llvmbot opened this issue Oct 31, 2012 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 31, 2012

Bugzilla Link 14223
Resolution FIXED
Resolved on Apr 07, 2014 07:32
Version trunk
OS Linux
Attachments Test for destructors on temporaries in the presence of exceptions
Reporter LLVM Bugzilla Contributor
CC @efriedma-quic,@hfinkel,@isanbard

Extended Description

Attached is a slimmed down case from a production code, where the presence of an 'if' statement in a function that passes through an exception will not have the destructors of its temporary variables called.

Note that this only happens when compiling with -O2. Any other optimization level, including -O3 will give the correct result.

To reproduce:

clang++ -O2 -o t test.cc
./t

Expected output:

AutoDestroy
~AutoDestroy
Exception: No pointer

Actual output:

AutoDestroy
Exception: No pointer

clang --version
clang version 3.2 (trunk 166893)
Target: x86_64-unknown-linux-gnu
Thread model: posix

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 7, 2014

This looks fixed in the latest trunk.

clang version 3.5.0 (205671)
Target: x86_64-unknown-linux-gnu
Thread model: posix

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen
Projects
None yet
Development

No branches or pull requests

1 participant