<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>16043</bug_id>
          
          <creation_ts>2003-02-19 18:22 0000</creation_ts>
          <short_desc>bc -l segfaults with -O2 cflags</short_desc>
          <delta_ts>2006-02-04 06:03:39 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>PPC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>slucy@uchicago.edu</reporter>
          <assigned_to>ppc@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>slucy@uchicago.edu</who>
            <bug_when>2003-02-19 18:22:26 0000</bug_when>
            <thetext>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 &quot;5/4&quot; | bc -ql
3.

Actual Results:  
Segmentation fault (core dumped)


Expected Results:  
1.25000000000000000000


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

Program received signal SIGSEGV, Segmentation fault.
addbyte (byte=75 &apos;K&apos;) at load.c:68
68      load.c: No such file or directory.
        in load.c
(gdb) backtrace
#0  addbyte (byte=75 &apos;K&apos;) at load.c:68
#1  0x100067d8 in load_code (code=0x4b &lt;Address 0x4b out of bounds&gt;)
    at load.c:307
#2  0x10008784 in generate (str=0x1000dd70 &quot;K&quot;) 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=&quot;http://gentoo.oregonstate.edu/
http://www.ibiblio.org/pub/Linux/distributions/gentoo&quot;
CONFIG_PROTECT=&quot;/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config&quot;
CONFIG_PROTECT_MASK=&quot;/etc/gconf /etc/env.d&quot;
PORTDIR=&quot;/usr/portage&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR_OVERLAY=&quot;&quot;
USE=&quot;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&quot;
COMPILER=&quot;gcc3&quot;
CHOST=&quot;powerpc-unknown-linux-gnu&quot;
CFLAGS=&quot;-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec -mpowerpc-gfxopt
-fsigned-char -g&quot;
CXXFLAGS=&quot;-O2 -pipe -mcpu=7400 -maltivec -mabi=altivec -mpowerpc-gfxopt
-fsigned-char&quot;
ACCEPT_KEYWORDS=&quot;ppc&quot;
MAKEOPTS=&quot;-j2&quot;
AUTOCLEAN=&quot;yes&quot;
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot;
FEATURES=&quot;ccache userpriv sandbox usersandbox&quot;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>justinb@imsa.edu</who>
            <bug_when>2003-02-19 18:30:47 0000</bug_when>
            <thetext>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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>slucy@uchicago.edu</who>
            <bug_when>2003-02-19 19:35:56 0000</bug_when>
            <thetext>update:  &quot;-O0 -f(everything in &apos;man gcc&apos;)&quot; runs just fine, whereas
&quot;-O1 -fno-(everthing in &apos;man gcc&quot; segfaults.
this is rather odd.


here&apos;s the list of -fs i&apos;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
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mguertin@macdiscussion.com</who>
            <bug_when>2003-02-19 20:24:24 0000</bug_when>
            <thetext>looking into this further, for now filtered -O2 for ppc</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vladimir@rio.com</who>
            <bug_when>2003-04-22 15:46:06 0000</bug_when>
            <thetext>What&apos;s the status on this? Gerk left, and I&apos;m trying to ping() a few bugs and try to see what&apos;s up.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>slucy@uchicago.edu</who>
            <bug_when>2003-04-24 01:39:07 0000</bug_when>
            <thetext>well the ebuild now filters -O2 for ppc, so the problem is &apos;solved&apos;.

i believe it is an upstream bug, but i don&apos;t know where gerk (or others)
were going with that, if they were.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vladimir@rio.com</who>
            <bug_when>2003-04-27 22:09:42 0000</bug_when>
            <thetext>Filtering works, yay</thetext>
          </long_desc>
      
    </bug>

</bugzilla>