public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64241] New: make_exception_ptr returns garbage with -fno-exceptions
@ 2014-12-09 15:26 redi at gcc dot gnu.org
2014-12-12 15:10 ` [Bug libstdc++/64241] " redi at gcc dot gnu.org
2014-12-12 16:09 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-09 15:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64241
Bug ID: 64241
Summary: make_exception_ptr returns garbage with
-fno-exceptions
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
#include <exception>
int main()
{
std::exception_ptr p = std::make_exception_ptr(1);
if (!p)
return 1;
}
g++ ex.cc -fno-exceptions -std=c++11 && valgrind ./a.out
==18255== Memcheck, a memory error detector
==18255== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==18255== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==18255== Command: ./a.out
==18255==
==18255== Conditional jump or move depends on uninitialised value(s)
==18255== at 0x40066A: main (in /tmp/a.out)
==18255==
==18255== Conditional jump or move depends on uninitialised value(s)
==18255== at 0x394C85EB3A: std::__exception_ptr::exception_ptr::_M_release()
(eh_ptr.cc:86)
==18255== by 0x40068A: main (in /tmp/a.out)
==18255==
==18255== Use of uninitialised value of size 8
==18255== at 0x394C85EB3C: std::__exception_ptr::exception_ptr::_M_release()
(eh_ptr.cc:90)
==18255== by 0x40068A: main (in /tmp/a.out)
==18255==
==18255==
==18255== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==18255== Bad permissions for mapped region at address 0x400670
==18255== at 0x394C85EB3C: std::__exception_ptr::exception_ptr::_M_release()
(eh_ptr.cc:90)
==18255== by 0x40068A: main (in /tmp/a.out)
==18255==
==18255== HEAP SUMMARY:
==18255== in use at exit: 0 bytes in 0 blocks
==18255== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==18255==
==18255== All heap blocks were freed -- no leaks are possible
==18255==
==18255== For counts of detected and suppressed errors, rerun with: -v
==18255== Use --track-origins=yes to see where uninitialised values come from
==18255== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 2 from 2)
Segmentation fault
We don't return anything when exceptions are disabled:
template<typename _Ex>
exception_ptr
make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
{
__try
{
#ifdef __EXCEPTIONS
throw __ex;
#endif
}
__catch(...)
{
return current_exception();
}
}
We should probably just return a default-constructed object.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/64241] make_exception_ptr returns garbage with -fno-exceptions
2014-12-09 15:26 [Bug libstdc++/64241] New: make_exception_ptr returns garbage with -fno-exceptions redi at gcc dot gnu.org
@ 2014-12-12 15:10 ` redi at gcc dot gnu.org
2014-12-12 16:09 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-12 15:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64241
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Dec 12 15:10:08 2014
New Revision: 218675
URL: https://gcc.gnu.org/viewcvs?rev=218675&root=gcc&view=rev
Log:
PR libstdc++/64241
* libsupc++/exception_ptr.h: Return empty object when exceptions are
disabled.
* testsuite/18_support/exception_ptr/64241.cc: New.
Added:
trunk/libstdc++-v3/testsuite/18_support/exception_ptr/64241.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/libsupc++/exception_ptr.h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/64241] make_exception_ptr returns garbage with -fno-exceptions
2014-12-09 15:26 [Bug libstdc++/64241] New: make_exception_ptr returns garbage with -fno-exceptions redi at gcc dot gnu.org
2014-12-12 15:10 ` [Bug libstdc++/64241] " redi at gcc dot gnu.org
@ 2014-12-12 16:09 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-12 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64241
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Not planning to backport this because using exception_ptr with -fno-exceptions
is probably not important to anyone.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-12 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 15:26 [Bug libstdc++/64241] New: make_exception_ptr returns garbage with -fno-exceptions redi at gcc dot gnu.org
2014-12-12 15:10 ` [Bug libstdc++/64241] " redi at gcc dot gnu.org
2014-12-12 16:09 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).