public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/28917] New: try/catch block removed. too optimistic optimization?
@ 2006-08-31 19:06 pluto at agmk dot net
2006-08-31 19:09 ` [Bug other/28917] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pluto at agmk dot net @ 2006-08-31 19:06 UTC (permalink / raw)
To: gcc-bugs
with fixed PR26208 we can throw exceptions from signal handlers.
catch() works pretty fine with complex call-chain but fails on
simple testcase.
#include <csignal>
void signalHandler( int signalNumber )
{
throw 0;
}
int main()
{
signal( SIGSEGV, signalHandler );
try
{
int* p = 0;
*p = 0;
}
catch ( int )
{
}
return 0;
}
$ g++ throw_from_sighandler.cpp -O1 --save-temps && ./a.out
terminate called after throwing an instance of 'int'
zsh: abort ./a.out
main:
subq $8, %rsp
movl $_Z13signalHandleri, %esi
movl $11, %edi
call signal
movl $0, 0
movl $0, %eax
addq $8, %rsp
ret
--
Summary: try/catch block removed. too optimistic optimization?
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC target triplet: x86-64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28917
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug other/28917] try/catch block removed. too optimistic optimization?
2006-08-31 19:06 [Bug other/28917] New: try/catch block removed. too optimistic optimization? pluto at agmk dot net
@ 2006-08-31 19:09 ` pinskia at gcc dot gnu dot org
2006-08-31 19:13 ` pluto at agmk dot net
2006-08-31 19:27 ` [Bug rtl-optimization/28917] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-31 19:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-08-31 19:08 -------
I think you forgot "-fnon-call-exceptions" which is need to be used if you want
non calls to be able to throw.
Can you try with that option and report if that fixes the problem?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28917
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug other/28917] try/catch block removed. too optimistic optimization?
2006-08-31 19:06 [Bug other/28917] New: try/catch block removed. too optimistic optimization? pluto at agmk dot net
2006-08-31 19:09 ` [Bug other/28917] " pinskia at gcc dot gnu dot org
@ 2006-08-31 19:13 ` pluto at agmk dot net
2006-08-31 19:27 ` [Bug rtl-optimization/28917] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pluto at agmk dot net @ 2006-08-31 19:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pluto at agmk dot net 2006-08-31 19:13 -------
it doesn't help. `jmp .L2` skips catch block :)
main:
pushq %rbx
movl $_Z13signalHandleri, %esi
movl $11, %edi
call signal
movl $0, 0
jmp .L2
.L8:
cmpq $1, %rdx
je .L3
movq %rax, %rdi
call _Unwind_Resume
.L3:
movq %rax, %rdi
call __cxa_begin_catch
movl (%rax), %eax
call __cxa_end_catch
jmp .L2
.L7:
movq %rax, %rbx
.L4:
call __cxa_end_catch
movq %rbx, %rdi
call _Unwind_Resume
.L2:
movl $0, %eax
popq %rbx
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28917
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/28917] try/catch block removed. too optimistic optimization?
2006-08-31 19:06 [Bug other/28917] New: try/catch block removed. too optimistic optimization? pluto at agmk dot net
2006-08-31 19:09 ` [Bug other/28917] " pinskia at gcc dot gnu dot org
2006-08-31 19:13 ` pluto at agmk dot net
@ 2006-08-31 19:27 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-31 19:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-08-31 19:27 -------
Actually yes it is branched because it should be but movl $0, 0
Means store 0 into the address of 0 so it works. The branch over is ok because
well this is the way zero overhead exceptions works.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|other |rtl-optimization
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28917
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-31 19:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-31 19:06 [Bug other/28917] New: try/catch block removed. too optimistic optimization? pluto at agmk dot net
2006-08-31 19:09 ` [Bug other/28917] " pinskia at gcc dot gnu dot org
2006-08-31 19:13 ` pluto at agmk dot net
2006-08-31 19:27 ` [Bug rtl-optimization/28917] " pinskia at gcc dot gnu dot 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).