public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols
@ 2015-07-02 12:34 doko at gcc dot gnu.org
2015-07-02 12:57 ` [Bug ipa/66738] " rguenth at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: doko at gcc dot gnu.org @ 2015-07-02 12:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
Bug ID: 66738
Summary: [5/6 Regression] optimizer bug related to exceptions
and static symbols
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: doko at gcc dot gnu.org
Target Milestone: ---
[forwarded from https://bugs.debian.org/788299]
seen with the gcc-5-branch 20150625 and trunk 20150610 (r224324)
$ g++-5 -g -O2 code.cpp && ./a.out
Segmentation fault (core dumped)
$ g++-5 -g -O0 code.cpp && ./a.out
terminate called after throwing an instance of 'MyException'
what(): MyException: No!
Aborted (core dumped)
$ g++-4.9 -g -O2 code.cpp && ./a.out
terminate called after throwing an instance of 'MyException'
what(): MyException: No!
Aborted (core dumped)
$ cat code.cpp
#include <exception>
#include <string>
class MyException : public std::exception
{
protected:
typedef std::exception Parent;
public:
MyException(const char* cStr): Parent(), m_reason(cStr) {
updateMessage();
}
virtual ~MyException() throw() {}
virtual const std::string& exceptionName() const {
return exceptionNameValue;
}
virtual const char* what() const throw() {
return m_exceptionMessage.c_str();
}
inline void updateMessage() {
m_exceptionMessage = exceptionName() + ": " + m_reason;
}
private:
std::string m_reason;
std::string m_exceptionMessage;
static const std::string exceptionNameValue;
};
const std::string MyException::exceptionNameValue("MyException");
int main() {
throw MyException("No!");
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
@ 2015-07-02 12:57 ` rguenth at gcc dot gnu.org
2015-07-02 12:57 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-02 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-07-02
CC| |hubicka at gcc dot gnu.org,
| |jamborm at gcc dot gnu.org
Component|tree-optimization |ipa
Target Milestone|--- |5.2
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed (with the old libstdc++ ABI). -O1 works. We segfault in libgcc:
Program received signal SIGSEGV, Segmentation fault.
_Unwind_Resume (exc=exc@entry=0x0)
at /space/rguenther/tramp3d/trunk/libgcc/unwind.inc:229
229 if (exc->private_1 == 0)
(gdb) bt
#0 _Unwind_Resume (exc=exc@entry=0x0)
at /space/rguenther/tramp3d/trunk/libgcc/unwind.inc:229
#1 0x0000000000400ad0 in main () at t.C:37
We optimize main to
Eh tree:
1 cleanup
3 cleanup land:{2,<L4>}
<bb 2>:
_3 = __cxa_allocate_exception (24);
MEM[(struct MyException *)_3].D.12544._vptr.exception = &MEM[(void
*)&_ZTV11MyException + 16B];
_7 = &MEM[(struct MyException *)_3].m_reason;
std::basic_string<char>::basic_string (_7, "No!", &D.13102);
;; succ: 3 [100.0%] (FALLTHRU,EXECUTABLE)
;; 4 (EH,EXECUTABLE)
<bb 3>:
D.13102 ={v} {CLOBBER};
MEM[(struct _Alloc_hider *)_3 + 16B]._M_p = &MEM[(void
*)&_S_empty_rep_storage + 24B];
__builtin_unreachable ();
<L4>:
D.13102 ={v} {CLOBBER};
_18 = &MEM[(struct MyException *)_3].D.12544;
std::exception::~exception (_18);
__builtin_eh_copy_values (1, 3);
__cxa_free_exception (_3);
_9 = __builtin_eh_pointer (1);
__builtin_unwind_resume (_9);
but the std::string constructor doesn't throw and thus we run into the
__builtin_unreachable ().
t.C.068t.fixup_cfg4: __builtin_unreachable ();
is where that appears. It's from devirtualization:
ipa-prop: Discovered a virtual call to a known target (void
MyException::updateMessage()/143 -> void __builtin_unreachable()/264), for stmt
_8 = OBJ_TYPE_REF(_6;this_2(D)->3) (this_2(D));
t.C:25:37: note: converting indirect call in void MyException::updateMessage()
to direct call to void __builtin_unreachable()
Speculative indirect call void MyException::updateMessage()/143 => virtual
const string& MyException::exceptionName() const/265 has turned out to have
contradicting known target __builtin_unreachable
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
2015-07-02 12:57 ` [Bug ipa/66738] " rguenth at gcc dot gnu.org
@ 2015-07-02 12:57 ` rguenth at gcc dot gnu.org
2015-07-08 18:31 ` jamborm at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-02 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fno-devirtualize fixes it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
2015-07-02 12:57 ` [Bug ipa/66738] " rguenth at gcc dot gnu.org
2015-07-02 12:57 ` rguenth at gcc dot gnu.org
@ 2015-07-08 18:31 ` jamborm at gcc dot gnu.org
2015-07-16 9:19 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jamborm at gcc dot gnu.org @ 2015-07-08 18:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
For the record, this PR can be bisected to r218024:
Author: hubicka
Date: Mon Nov 24 16:15:46 2014 +0000
PR ipa/63671
* ipa-inline-transform.c (can_remove_node_now_p_1): Handle alises
and -fno-devirtualize more carefully.
(can_remove_node_now_p): Update.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
` (2 preceding siblings ...)
2015-07-08 18:31 ` jamborm at gcc dot gnu.org
@ 2015-07-16 9:19 ` rguenth at gcc dot gnu.org
2015-10-12 8:12 ` hubicka at gcc dot gnu.org
2015-10-16 6:25 ` hubicka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16 9:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|5.2 |5.3
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
` (3 preceding siblings ...)
2015-07-16 9:19 ` rguenth at gcc dot gnu.org
@ 2015-10-12 8:12 ` hubicka at gcc dot gnu.org
2015-10-16 6:25 ` hubicka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-10-12 8:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |hubicka at gcc dot gnu.org
--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Mine
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug ipa/66738] [5/6 Regression] optimizer bug related to exceptions and static symbols
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
` (4 preceding siblings ...)
2015-10-12 8:12 ` hubicka at gcc dot gnu.org
@ 2015-10-16 6:25 ` hubicka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-10-16 6:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66738
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
r218024 probably just uncovers symptoms. This is the same negative offset bug
as the other PR.
*** This bug has been marked as a duplicate of bug 67056 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-10-16 6:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-02 12:34 [Bug tree-optimization/66738] New: [5/6 Regression] optimizer bug related to exceptions and static symbols doko at gcc dot gnu.org
2015-07-02 12:57 ` [Bug ipa/66738] " rguenth at gcc dot gnu.org
2015-07-02 12:57 ` rguenth at gcc dot gnu.org
2015-07-08 18:31 ` jamborm at gcc dot gnu.org
2015-07-16 9:19 ` rguenth at gcc dot gnu.org
2015-10-12 8:12 ` hubicka at gcc dot gnu.org
2015-10-16 6:25 ` hubicka 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).