Bug 114822 - Kpdf-3.5.0-r1 crashes when compiled with -Os
Bug#: 114822 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: critical Priority: P2
Resolution: FIXED Assigned To: kde@gentoo.org Reported By: jdorlack@gmail.com
Component: KDE
URL: 
Summary: Kpdf-3.5.0-r1 crashes when compiled with -Os
Keywords:  
Status Whiteboard: 
Opened: 2005-12-07 18:38 0000
Description:   Opened: 2005-12-07 18:38 0000
Emerged kpdf with -Os and every time I opened a pdf got "Program recieved 
segfault" I couldn't backtrace. So i searched aroung and saw a post on Gentoo 
forums pointing out that it may be due to -Os CFLAGS so I compiled with -O2 and 
works prefectly.

Reproducible: Always
Steps to Reproduce:
1.Change CFLAGS to -Os
2.emerge -av =kde-base/kpdf-3.5.0-r1
3.Open pdf document

Actual Results:  
segfault cannot backtrace

Expected Results:  
Opened and viewed pdf document.

My CFLAGS are -Os (normally) -fomit-frame-pointer -pipe nothing in my system is 
riced out ;) running gcc 3.4.4 with x86 stable TK.

heres emerge --info
Portage 2.0.51.22-r3 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r3, 2.6.
14-nitro2 i686)
=================================================================
System uname: 2.6.14-nitro2 i686 Intel(R) Celeron(R) CPU 2.40GHz
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) 
[enabled]
ccache version 2.3 [disabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -pipe -Os -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/
share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/mozilla/
defaults/pref /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -mtune=pentium4 -pipe -Os -fweb -frename-registers -
fforce-addr -fomit-frame-pointer -ftracer -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distcc distlocks sandbox sfperms"
GENTOO_MIRRORS="http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/
distributions/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 crypt cups doc 
eds emboss encode esd exif expat fam foomaticdb fortran gdbm gif glut gnome gpm 
gstreamer gtk gtk2 idn imlib ipv6 java jpeg junit lcms libg++ libwww mad mikmod 
mng motif mozilla mp3 mpeg ncurses nls nptl ogg oggvorbis opengl oss pam pcre 
pdflib perl pic png python quicktime readline sdl spell ssl tcpd tiff truetype 
truetype-fonts type1-fonts udev vorbis xine xml xml2 xmms xv zlib userland_GNU 
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS

------- Comment #1 From Diego E. 'Flameeyes' Pettenò 2005-12-08 03:54:07 0000 -------
Works fine here with -Os... 
 

------- Comment #2 From James 2005-12-08 10:00:40 0000 -------
maybe its gcc 3.4.4? 

------- Comment #3 From James 2005-12-08 22:34:32 0000 -------
must be local

------- Comment #4 From Georgios E. Kylafas 2005-12-13 09:06:23 0000 -------
I have also experienced crashes in KPDF when compiled with -Os. Not all my 
pdfs caused it to crash, and those that did were not especially large. An 
example pdf file causing crashes is the "GNU Privacy Handbook" (the version 
created in 08/08/2000 and produced by pdfTex 13.c, but probably other versions 
as well). 
This kind of behavior is also reported in bugs 112854 and 115048 in KDE's  
bugzilla. 
IMHO, I think you should play it safe and filter out the "-Os" optimization  
for KPDF.  

------- Comment #5 From James 2005-12-13 19:54:28 0000 -------
glad to hear it wasnt local =) for me -O2 fixed everything maybe the ebuild
should force -O2?

------- Comment #6 From James 2005-12-14 14:17:25 0000 -------
im reopening this bug

------- Comment #7 From rumzajs@gmx.net 2005-12-20 12:40:19 0000 -------
i can confirm this, everything works fine except pdf, kpdf/xpdf both crash on
almost any pdf file

Portage 2.1_pre1 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r3,
2.6.14-ge
ntoo-r5 i686)
=================================================================
System uname: 2.6.14-gentoo-r5 i686 AMD Athlon(TM) XP 2500+
Gentoo Base System version 1.12.0_pre11
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/
config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-Os -march=athlon-xp -pipe"
DISTDIR="/portage/distfiles"
FEATURES="autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://pandemonium.tiscali.de/pub/gentoo/"
LINGUAS="de"
PKGDIR="/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowext X alsa apm audiofile avi berkdb bitmap-fonts bzip2 cdr
c
rypt cups curl dvd eds emboss encode esd expat fam foomaticdb fortran gdbm gif
g
lut gmp gpm gstreamer gtk2 idn imagemagick imlib ipv6 jpeg kde lcms libg++
libww
w mad mikmod mng motif mp3 mpeg ncurses nls nptl nptlonly ogg oggvorbis openal
o
pengl oss pam pcre pdflib perl png python qt quicktime readline sdl spell ssl
tc
pd tiff truetype truetype-fonts type1-fonts udev userlocales vorbis xml2 xmms
xv
 zlib elibc_glibc kernel_linux linguas_de userland_GNU"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, MAKEOPTS

------- Comment #8 From Ruben Jenster 2005-12-30 10:24:35 0000 -------
Hi,

while I do experience crahses with several pdfs on my desktop
CFLAGS="-march=athlon-xp -Os -pipe -fomit-frame-pointer"
the same files open fine on my laptop
CFLAGS="-march=pentium-m -Os -pipe -fomit-frame-pointer"

recompiling kpdf with '-O2 ' on the desktop does solves the problem.

It seems to me that only certain combinations with '-Os' do crash kpdf.

--> this is the same for both machines.
Portage 2.0.53 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r2,

------- Comment #9 From Carsten Lohrke 2005-12-30 17:47:26 0000 -------
Enough evidence, thanks for your reports. :)