$ 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