public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/25515]  New: broken exceptions with -Os ?
@ 2005-12-21 14:56 pluto at agmk dot net
  2005-12-21 14:57 ` [Bug other/25515] " pluto at agmk dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-12-21 14:56 UTC (permalink / raw)
  To: gcc-bugs

$ make clean all OPT=-Os
rm -rf *.ii *.o *.s lib.so main
g++ -Os lib.cpp -fPIC -shared -Wl,-soname,lib -o lib.so
g++ -Os main.cpp -o main -ldl
LD_LIBRARY_PATH=./ ./main
Memory fault

works fine with -O[0123].

$ g++ -v
Reading specs from /usr/lib64/gcc/amd64-pld-linux/3.4.5/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib64
--libexecdir=/usr/lib64 --infodir=/usr/share/info --mandir=/usr/share/man
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-languages=c,c++,f77,objc,ada,java --enable-c99 --enable-long-long
--enable-nls --with-gnu-as --with-gnu-ld --with-system-zlib
--with-slibdir=/lib64 --without-x amd64-pld-linux
Thread model: posix
gcc version 3.4.5 (PLD Linux)


-- 
           Summary: broken exceptions with -Os ?
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: amd64-linux
  GCC host triplet: amd64-linux
GCC target triplet: amd64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25515


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/25515] broken exceptions with -Os ?
  2005-12-21 14:56 [Bug other/25515] New: broken exceptions with -Os ? pluto at agmk dot net
@ 2005-12-21 14:57 ` pluto at agmk dot net
  2005-12-21 18:02 ` pluto at agmk dot net
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-12-21 14:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2005-12-21 14:57 -------
Created an attachment (id=10545)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10545&action=view)
testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25515


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/25515] broken exceptions with -Os ?
  2005-12-21 14:56 [Bug other/25515] New: broken exceptions with -Os ? pluto at agmk dot net
  2005-12-21 14:57 ` [Bug other/25515] " pluto at agmk dot net
@ 2005-12-21 18:02 ` pluto at agmk dot net
  2005-12-21 18:30 ` pluto at agmk dot net
  2005-12-25  1:08 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-12-21 18:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pluto at agmk dot net  2005-12-21 18:02 -------
if I change the myexception definition to:

struct myexception : public std::exception {};

then testcase will crashe at all optimization levels on i386/amd64.

Program received signal SIGSEGV, Segmentation fault.
0xb7ef7a06 in ?? ()
(gdb) bt
#0  0xb7ef7a06 in ?? ()
#1  0xb7eb42eb in __cxa_throw () from /usr/lib/libstdc++.so.6
#2  0xb7dde6ed in _Unwind_DeleteException () from /lib/libgcc_s.so.1
#3  0xb7eb34e6 in __cxa_end_catch () from /usr/lib/libstdc++.so.6
#4  0x08048777 in main () at main.cpp:25

this backtrace comes from gcc-4.1/i386.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25515


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/25515] broken exceptions with -Os ?
  2005-12-21 14:56 [Bug other/25515] New: broken exceptions with -Os ? pluto at agmk dot net
  2005-12-21 14:57 ` [Bug other/25515] " pluto at agmk dot net
  2005-12-21 18:02 ` pluto at agmk dot net
@ 2005-12-21 18:30 ` pluto at agmk dot net
  2005-12-25  1:08 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-12-21 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pluto at agmk dot net  2005-12-21 18:30 -------
i suppose the lib.so and myexception's typeinfo is unavailable
after unwinding the try{} block (due to ~dll/dlclose) which is
a reason why the program crash. am i rigth?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25515


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/25515] broken exceptions with -Os ?
  2005-12-21 14:56 [Bug other/25515] New: broken exceptions with -Os ? pluto at agmk dot net
                   ` (2 preceding siblings ...)
  2005-12-21 18:30 ` pluto at agmk dot net
@ 2005-12-25  1:08 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  1:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-12-25 01:07 -------
The code is invalid as the undwinding of the stack also dlclose the shared
library which causes the typeinfo to go back.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25515


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-25  1:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-21 14:56 [Bug other/25515] New: broken exceptions with -Os ? pluto at agmk dot net
2005-12-21 14:57 ` [Bug other/25515] " pluto at agmk dot net
2005-12-21 18:02 ` pluto at agmk dot net
2005-12-21 18:30 ` pluto at agmk dot net
2005-12-25  1:08 ` 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).