* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
@ 2007-11-19 16:21 ` asteinarson at gmail dot com
2007-12-11 10:38 ` phelps at gnusto dot com
` (13 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2007-11-19 16:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from asteinarson at gmail dot com 2007-11-19 16:21 -------
I found something out. If I add a further function call to FuncNested1:
int FuncNested2( ){
StructWithDtor swd;
return 0;
}
int FuncNested1( int *pi ){
StructWithDtor swd;
FuncNested2( ); // This trigger unwind table generation
return *pi;
}
then it works. It seems that FuncNested1 in the first form:
int FuncNested1( int *pi ){
StructWithDtor swd;
return *pi;
}
never generates any unwinding information (since it doesn't call other
functions) and when SIGSEGV happens inside it, it cannot find any unwind tables
and C++ run-time bails out. I can understand the logic behind this, but it
certainly made my first test case fail miserably.
In a realworld app, the optimization is probably OK, since a function
generating the signal is likely to contain other function calls (not bullet
proof).
It is possible to interpret -asynchronous-unwind-tables to support this but
that option changes nothing for my test case.
An option -always-generate-unwind-tables would be useful in this case (but
probably results in a larger executable).
Regards
// ATS.
--
asteinarson at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asteinarson at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
2007-11-19 16:21 ` [Bug c++/34152] " asteinarson at gmail dot com
@ 2007-12-11 10:38 ` phelps at gnusto dot com
2007-12-11 10:43 ` phelps at gnusto dot com
` (12 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: phelps at gnusto dot com @ 2007-12-11 10:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from phelps at gnusto dot com 2007-12-11 10:38 -------
Created an attachment (id=14728)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14728&action=view)
proposed fix
I'm seeing similar behavior on x86-64 with both g++-4.1.3 (ubuntu-7.10 dist)
and g++-4.2.2 build from sources. I spent some time in the debugger and I've
identified the problem and a fix.
It looks like the problem first appeared in r115654. The change to
eh_personality.cc guards a call to _Unwind_GetIPInfo with the preprocessor
macro HAVE_GETIPINFO. Unfortunately, that macro HAVE_GETIPINFO is never
defined in c++config.h; _GLIBCXX_HAVE_GETIPINFO is.
The attached patch (against gcc-4.2.2) fixes this issue and the resulting
libstdc++.so.6.0.9 produces the desired behavior.
Thanks,
-Ted
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
2007-11-19 16:21 ` [Bug c++/34152] " asteinarson at gmail dot com
2007-12-11 10:38 ` phelps at gnusto dot com
@ 2007-12-11 10:43 ` phelps at gnusto dot com
2007-12-11 17:55 ` asteinarson at gmail dot com
` (11 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: phelps at gnusto dot com @ 2007-12-11 10:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from phelps at gnusto dot com 2007-12-11 10:43 -------
Added Steve Ellcey to the CC as he's the author of r115654. Hope that's not
rude.
Thanks,
-Ted
--
phelps at gnusto dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sje at cup dot hp dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (2 preceding siblings ...)
2007-12-11 10:43 ` phelps at gnusto dot com
@ 2007-12-11 17:55 ` asteinarson at gmail dot com
2007-12-11 22:30 ` phelps at gnusto dot com
` (10 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2007-12-11 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from asteinarson at gmail dot com 2007-12-11 17:55 -------
(In reply to comment #2)
> Created an attachment (id=14728)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14728&action=view) [edit]
> proposed fix
>
> I'm seeing similar behavior on x86-64 with both g++-4.1.3 (ubuntu-7.10 dist)
> and g++-4.2.2 build from sources. I spent some time in the debugger and I've
> identified the problem and a fix.
>
> ...
>
> The attached patch (against gcc-4.2.2) fixes this issue and the resulting
> libstdc++.so.6.0.9 produces the desired behavior.
>
Good to see a solution. When/where is it reasonable to expect the patch in a
release? Would it go into 4.2 or 4.3 or would it be backported to 4.1 series?
Regards
// ATS
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (3 preceding siblings ...)
2007-12-11 17:55 ` asteinarson at gmail dot com
@ 2007-12-11 22:30 ` phelps at gnusto dot com
2007-12-11 22:49 ` jakub at gcc dot gnu dot org
` (9 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: phelps at gnusto dot com @ 2007-12-11 22:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from phelps at gnusto dot com 2007-12-11 22:30 -------
Created an attachment (id=14732)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14732&action=view)
minimal test case
This attachment contains a minimal C++ program that exhibits the behavior. The
program should exit with a return code of 0, but without the patch above it
produces the following output:
terminate called after throwing an instance of 'int'
-Ted
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (4 preceding siblings ...)
2007-12-11 22:30 ` phelps at gnusto dot com
@ 2007-12-11 22:49 ` jakub at gcc dot gnu dot org
2008-01-06 18:09 ` asteinarson at gmail dot com
` (8 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-11 22:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2007-12-11 22:49 -------
Benjamin, the patch in #c4 looks good to me and this is a very severe bug,
could
you please review the patch and apply if you agree?
Wonder what kind of testing was done before r115654 commit :(.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkoz at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (5 preceding siblings ...)
2007-12-11 22:49 ` jakub at gcc dot gnu dot org
@ 2008-01-06 18:09 ` asteinarson at gmail dot com
2008-01-06 20:55 ` jakub at gcc dot gnu dot org
` (7 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2008-01-06 18:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from asteinarson at gmail dot com 2008-01-06 17:02 -------
(In reply to comment #2)
> Created an attachment (id=14728)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14728&action=view) [edit]
> proposed fix
>
> I'm seeing similar behavior on x86-64 with both g++-4.1.3 (ubuntu-7.10 dist)
> and g++-4.2.2 build from sources. I spent some time in the debugger and I've
> identified the problem and a fix.
>
I've applied this path to GCC 4.3.0 (as of 2008-01-04). Unfortunately the
problem is still there for me. Both in the original test case and in the
non-call-except-cpp test case.
Regards
// ATS
>
> Thanks,
> -Ted
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (6 preceding siblings ...)
2008-01-06 18:09 ` asteinarson at gmail dot com
@ 2008-01-06 20:55 ` jakub at gcc dot gnu dot org
2008-01-06 23:34 ` asteinarson at gmail dot com
` (6 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-06 20:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2008-01-06 20:26 -------
Subject: Bug 34152
Author: jakub
Date: Sun Jan 6 20:25:57 2008
New Revision: 131361
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131361
Log:
PR c++/34152
* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check
_GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/libsupc++/eh_personality.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (7 preceding siblings ...)
2008-01-06 20:55 ` jakub at gcc dot gnu dot org
@ 2008-01-06 23:34 ` asteinarson at gmail dot com
2008-01-07 14:03 ` asteinarson at gmail dot com
` (5 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2008-01-06 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from asteinarson at gmail dot com 2008-01-06 23:18 -------
(In reply to comment #8)
> Subject: Bug 34152
>
> Author: jakub
> Date: Sun Jan 6 20:25:57 2008
> New Revision: 131361
>
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131361
> Log:
> PR c++/34152
> * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check
> _GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO.
I've checked this. From line 446 of libsupc++/eh_personality.cc:
// Parse the LSDA header.
p = parse_lsda_header (context, language_specific_data, &info);
info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
#ifdef _GLIBCXX_HAVE_GETIPINFO
ip = _Unwind_GetIPInfo (context, &ip_before_insn);
#else
ip = _Unwind_GetIP (context);
#endif
I've rebuild with the patch in a clean directory. g++ --version gives:
$ g++43 --version
g++43 (GCC) 4.3.0 20080104 (experimental)
Regards
// ATS
>
> Modified:
> trunk/libstdc++-v3/ChangeLog
> trunk/libstdc++-v3/libsupc++/eh_personality.cc
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (8 preceding siblings ...)
2008-01-06 23:34 ` asteinarson at gmail dot com
@ 2008-01-07 14:03 ` asteinarson at gmail dot com
2008-01-07 16:44 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2008-01-07 14:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from asteinarson at gmail dot com 2008-01-07 13:24 -------
(In reply to comment #9)
> (In reply to comment #8)
> > Subject: Bug 34152
> >
> > * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check
> > _GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO.
>
> I've checked this. From line 446 of libsupc++/eh_personality.cc:
The trouble was that the GCC 4.3 was linking executables to the old version of
libstdc++ (4.1).
Setting LD_LIBRARY_PATH did the trick. Both test cases work now.
Regards
// ATS
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (9 preceding siblings ...)
2008-01-07 14:03 ` asteinarson at gmail dot com
@ 2008-01-07 16:44 ` jakub at gcc dot gnu dot org
2008-01-09 7:06 ` phelps at gnusto dot com
` (3 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-01-07 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jakub at gcc dot gnu dot org 2008-01-07 16:06 -------
Subject: Bug 34152
Author: jakub
Date: Mon Jan 7 16:05:27 2008
New Revision: 131376
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131376
Log:
PR c++/34152
* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check
_GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO.
Modified:
branches/gcc-4_2-branch/libstdc++-v3/ChangeLog
branches/gcc-4_2-branch/libstdc++-v3/libsupc++/eh_personality.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (10 preceding siblings ...)
2008-01-07 16:44 ` jakub at gcc dot gnu dot org
@ 2008-01-09 7:06 ` phelps at gnusto dot com
2008-01-09 7:40 ` phelps at gnusto dot com
` (2 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: phelps at gnusto dot com @ 2008-01-09 7:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from phelps at gnusto dot com 2008-01-09 05:53 -------
re: comment #7, could you double-check with ldd that your application is
picking up the right libstdc++.so? You may have to fiddle with your
LD_LIBRARY_PATH to make it do so.
-Ted
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (11 preceding siblings ...)
2008-01-09 7:06 ` phelps at gnusto dot com
@ 2008-01-09 7:40 ` phelps at gnusto dot com
2008-03-12 16:14 ` pinskia at gcc dot gnu dot org
2008-03-12 16:42 ` asteinarson at gmail dot com
14 siblings, 0 replies; 17+ messages in thread
From: phelps at gnusto dot com @ 2008-01-09 7:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from phelps at gnusto dot com 2008-01-09 05:54 -------
re: comment #12 -- sorry, just read comment #10. Ignore me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (12 preceding siblings ...)
2008-01-09 7:40 ` phelps at gnusto dot com
@ 2008-03-12 16:14 ` pinskia at gcc dot gnu dot org
2008-03-12 16:42 ` asteinarson at gmail dot com
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-12 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from pinskia at gcc dot gnu dot org 2008-03-12 16:14 -------
*** Bug 35555 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/34152] Erratic behaviour: Exception translation (throw from signal handlers)
2007-11-19 14:39 [Bug c++/34152] New: Erratic behaviour: Exception translation (throw from signal handlers) asteinarson at gmail dot com
` (13 preceding siblings ...)
2008-03-12 16:14 ` pinskia at gcc dot gnu dot org
@ 2008-03-12 16:42 ` asteinarson at gmail dot com
14 siblings, 0 replies; 17+ messages in thread
From: asteinarson at gmail dot com @ 2008-03-12 16:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from asteinarson at gmail dot com 2008-03-12 16:41 -------
I had missed to use the flag -fnon-call-exceptions.
With that enabled it works as it should.
Regards
// ATS
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34152
^ permalink raw reply [flat|nested] 17+ messages in thread