Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 16043 - bc -l segfaults with -O2 cflags
Summary: bc -l segfaults with -O2 cflags
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: PPC Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-19 18:22 UTC by Steven Lucy
Modified: 2006-02-04 06:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Lucy 2003-02-19 18:22:26 UTC
bc, with the -l option, segfaults when you enter any calculation to perform.

this only happens with -O2 in CFLAGS.  the ebuild should strip this out, or
another fix should be implemented.

Reproducible: Always
Steps to Reproduce:
1. emerge sys-devel/bc-1.06-r4
2. echo "5/4" | bc -ql
3.

Actual Results:  
Segmentation fault (core dumped)


Expected Results:  
1.25000000000000000000


CFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec -mpowerpc-gfxopt
-fsigned-char -g"
(removing the -O2 fixes the problem)

Program received signal SIGSEGV, Segmentation fault.
addbyte (byte=75 'K') at load.c:68
68      load.c: No such file or directory.
        in load.c
(gdb) backtrace
#0  addbyte (byte=75 'K') at load.c:68
#1  0x100067d8 in load_code (code=0x4b <Address 0x4b out of bounds>)
    at load.c:307
#2  0x10008784 in generate (str=0x1000dd70 "K") at util.c:278
#3  0x1000330c in yyparse () at bc.y:545
#4  0x10002260 in main (argc=2, argv=0x7ffffb44) at main.c:259
#5  0x0fdfedec in __libc_start_main () from /lib/libc.so.6

Portage 2.0.47-r2 (default-ppc-1.4, gcc-3.2.1, glibc-2.2.5-r4,2.3.1-r2)
=================================================================
System uname: 2.4.19-r6 ppc 
GENTOO_MIRRORS="http://gentoo.oregonstate.edu/
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="oss dvd xv jpeg nls mitshm gif sdl png truetype ppc gdbm berkdb slang
readline tetex aalib java gpm tcpd pam libwww ssl perl python esd imlib
oggvorbis motif opengl mozilla X gtk -gnome -alsa -kde -qt"
COMPILER="gcc3"
CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec -mpowerpc-gfxopt
-fsigned-char -g"
CXXFLAGS="-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec -mpowerpc-gfxopt
-fsigned-char"
ACCEPT_KEYWORDS="ppc"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="ccache userpriv sandbox usersandbox"
Comment 1 Justin Blanchard 2003-02-19 18:30:47 UTC
This also happens under gcc 2.95.3 (i.e., a 1.0 profile). Although the numbers in the backtrace are different, the trace itself is the same.
Comment 2 Steven Lucy 2003-02-19 19:35:56 UTC
update:  "-O0 -f(everything in 'man gcc')" runs just fine, whereas
"-O1 -fno-(everthing in 'man gcc" segfaults.
this is rather odd.


here's the list of -fs i'm working with:

 -fsigned-char 
-ffloat-store -fdefault-inline -fdefer-pop -fforce-mem -fforce-addr
-fomit-frame-pointer -foptimize-sibling-calls -ftrapv -finline
-fkeep-static-consts -fmerge-constants -fmerge-all-constants -fbranch-count-reg
-ffunction-cse -fmath-errno -funsafe-math-optimizations -ftrapping-math
-fbounds-check -fstrength-reduce -fthread-jumps -fcse-follow-jumps
-fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm
-fgcse-sm -fdelete-null-pointer-checks -fexpensive-optimizations
-foptimize-register-move -fregmove -fdelayed-branch -fschedule-insns
-fschedule-insns2 -fsched-interblock -fsched-spec -fschedule-insns
-fsched-spec-load -ffunction-sections -fdata-sections
Comment 3 Mark Guertin 2003-02-19 20:24:24 UTC
looking into this further, for now filtered -O2 for ppc
Comment 4 Graham Forest 2003-04-22 15:46:06 UTC
What's the status on this? Gerk left, and I'm trying to ping() a few bugs and try to see what's up.
Comment 5 Steven Lucy 2003-04-24 01:39:07 UTC
well the ebuild now filters -O2 for ppc, so the problem is 'solved'.

i believe it is an upstream bug, but i don't know where gerk (or others)
were going with that, if they were.
Comment 6 Graham Forest 2003-04-27 22:09:42 UTC
Filtering works, yay