std::uncaught_exception() returns true after catching an exception thrown with std::rethrow_exception
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | gcc |
Confirmed
|
Medium
|
||
| | gcc-4.9 (Ubuntu) |
Undecided
|
Unassigned | ||
Bug Description
See attached testcase.
On debugging, it seems that std::rethrow_
ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: libstdc++6 4.9.2-10ubuntu12
ProcVersionSign
Uname: Linux 3.19.0-10-generic x86_64
ApportVersion: 2.17-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Apr 2 10:50:37 2015
Dependencies:
gcc-4.9-base 4.9.2-10ubuntu12
gcc-5-base 5-20150328-0ubuntu2
libc6 2.21-0ubuntu4
libgcc1 1:5-20150328-
multiarch-support 2.21-0ubuntu4
InstallationDate: Installed on 2013-08-06 (603 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
SourcePackage: gcc-4.9
UpgradeStatus: Upgraded to vivid on 2013-08-06 (603 days ago)
Related branches
|
|
#4 |
Created attachment 33394
A simple test case.
|
|
#5 |
Created attachment 33395
Proposed patch
I believe the problem is that std::rethrow_
A proposed patch is attached.
|
|
#6 |
I can confirm this bug.
It even occurs with GCC 4.8.2 (on Ubuntu 14.04).
|
|
#7 |
PR61643 shares the root cause with this PR. The behavior of the test case in PR61643 completely agrees with the analysis in Comment 2, and the proposed patch makes the test case in PR61643 work properly.
I confirmed that this bug was reproduced with 4.8.4 20140925, 4.9.2 20140924 and 5.0.0 20140928.
|
|
#8 |
*** Bug 61643 has been marked as a duplicate of this bug. ***
|
|
#9 |
I can also confirm this bug (I have a test case with std::async and future, but it internally uses std::rethrow_
Known to work: gcc 4.6.3, 4.7.2, 4.8.1
Known to fail: gcc 4.8.2, 4.9.2, clang 3.5.0
So this is a regression.
|
|
#10 |
Confirmed using GCC 5.0.0 20150125 built from source (see below) and 4.7.2 (Debian 4.7.2-5; Debian Wheezy). Tested using the test case in comment 1.
Output:
$ g++-5-20150125 -std=c++11 -o test62258 test62258.c -Wall && ./test62258
test62258: test62258.c:11: int main(): Assertion `!std::
Aborted
$ g++-5-20150125 -v
Using built-in specs.
COLLECT_
COLLECT_
Target: x86_64-
Configured with: /home/user/
Thread model: posix
gcc version 5.0.0 20150125 (experimental) (GCC)
|
|
#11 |
Created attachment 34683
Workaround code
For all programmers out there that may encounter this bug, I attach a workaround code.
Linking your program with it should make rethrow_exception() usable even if the library on the system is buggy.
|
|
#12 |
A few days ago I submitted a patch for this issue based on Dmitry's patch. It seems as if we can get it in after the 5.0 release.
| Chris Halse Rogers (raof) wrote : | #1 |
| Chris Halse Rogers (raof) wrote : | #2 |
Patch at https:/
| Changed in gcc: | |
| importance: | Unknown → Medium |
| status: | Unknown → Confirmed |
|
|
#13 |
doko, this fails for me with 4.8.1, and 4.7.4 and 4.8.0
There are no changes between 4.8.1 and 4.8.2 that could have affected this.
Are you sure it's a regression?
| Launchpad Janitor (janitor) wrote : | #14 |
This bug was fixed in the package gcc-4.9 - 4.9.2-16ubuntu1
---------------
gcc-4.9 (4.9.2-16ubuntu1) wily; urgency=medium
* Update to SVN 20150508 (r222909) from the gcc-4_9-branch.
gcc-4.9 (4.9.2-16) unstable; urgency=medium
* Update to SVN 20150503 (r222750) from the gcc-4_9-branch.
- Fix the build failure on alpha.
* Fix gcc-itm doc-base file (Guo Yixuan). Closes: #783998.
* On m68k, powerpcspe, sh4, sparc64, still build the libraries not
yet built by gcc-5.
* Update the cross-biarch patch for D and Go.
* Apply the cross-biarch patches for every cross build. Closes: #783527.
gcc-4.9 (4.9.2-15) unstable; urgency=medium
* Update the Linaro support to the 4.9-2015.04 release.
gcc-4.9 (4.9.2-14) unstable; urgency=medium
* Update to SVN 20150429 (r222567) from the gcc-4_9-branch.
* Build again libgo.
* PR libstdc++/62258, fix for std::uncaught_
LP: #1439451.
gcc-4.9 (4.9.2-13) unstable; urgency=medium
* Update to SVN 20150426 (r222448) from the gcc-4_9-branch.
* Build using isl 0.14 and cloog 0.18.3.
* Provide the /usr/include/
gcc-4.9 (4.9.2-12) experimental; urgency=medium
* Stop building libcilkrts and libtsan, build again libasan.
gcc-4.9 (4.9.2-11) experimental; urgency=medium
* Update to SVN 20150411 (r222011) from the gcc-4_9-branch.
- Fix PR libstdc++/64476, PR libstdc++/60966, PR libstdc++/64239,
PR libstdc++/64649, PR libstdc++/64584, PR libstdc++/64585,
PR libstdc++/64646, PR middle-end/64734, PR c/61553,
PR middle-end/63704 (ice on valid), PR target/64513 (x86),
PR rtl-optimizatio
PR middle-end/64391 (ice on valid), PR c++/54442 (ice on valid),
PR target/64358 (rs6000, wrong code), PR target/63424 (AArch64, ice on
valid), PR target/64479 (SH), PR rtl-optimizatio
(rs6000), PR target/61413 (ARM, wrong code), PR target/64507 (SH),
PR target/64409 (x32, ice on valid), PR c++/64487 (ice on valid),
PR c++/64352, PR c++/64251 (rejects valid), PR c++/64297 (ice on valid),
PR c++/64029 (ice on valid), PR c++/63657 (diagnostic), PR c++/38958
(diagnostic), PR c++/63658 (rejects valid), PR ada/64492 (build),
PR fortran/64528 (ice on valid), PR fortran/63733 (wrong code),
PR fortran/56867 (wrong code), PR fortran/64244 (ice on valid),
PR target/64795 (x86), PR middle-end/64734 (ice),
PR rtl-optimizatio
PR fortran/64230 (wrong code), PR fortran/64771 (ice on valid),
PR fortran/57023 (wrong code), PR fortran/60922 (wrong code), PR c/64766
(ice), PR c/64778 (ice), PR rtl-optimizatio
PR middle-end/64421 (OpenMP), PR rtl-optimizatio
PR rtl-optimizatio
PR debug/64663 (ice), PR c++/64521 (ice), PR fortran/62044 (ice),
PR libstdc++/64680, PR libstdc++/64649, PR target/64882 (x86),
PR c++/64901, PR target/64938 (ICE, ARM), PR ipa/64068, PR ipa/64559,
PR c/64824 (OpenMP), PR c/64868 (Op...
| Changed in gcc-4.9 (Ubuntu): | |
| status: | New → Fix Released |
| Matthias Klose (doko) wrote : | #15 |
fixed in gcc-4.9 and gcc-5 in wily (15.10)
Hello Chris, or anyone else affected,
Accepted gccgo-4.9 into trusty-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| tags: | added: verification-needed |
| Steve Langasek (vorlon) wrote : | #17 |
This bug was not identified with gccgo, only with g++, which is not applicable to the in-progress gccgo-4.9 SRU.
| tags: | removed: verification-needed |
The verification of the Stable Release Update for gccgo-4.9 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

After using std::rethrow_ exception( ) (and catching the exception), all subsequent calls to std::uncaught_ exception( ) return `true', which is obviously not the way it was meant to work.
A simple test case is attached.