Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 83549 - "sed" seg-faults on PPC with CFLAGS="...-fno-strict-aliasing..."
Summary: "sed" seg-faults on PPC with CFLAGS="...-fno-strict-aliasing..."
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: PPC Linux
: High major (vote)
Assignee: PPC Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-28 06:24 UTC by meyerm
Modified: 2005-03-05 05:36 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 meyerm 2005-02-28 06:24:05 UTC
Hi,

sed-4.1.4 fails on PPC when compiled with "-fno-strict-aliasing". I updated to 4.1.4 and now sed seg-faults when faced with some weird GNU autotools calls. I recompiled several times using different CFLAG combinations. CFLAGS="-O2 -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -ftracer -funit-at-a-time -pipe" works.

That's bad since "-fno-strict-aliasing" is default for the PPC make.conf.

Example (from the build of pam-0.78):
../dist/configure: line 1579: 17212 Segmentation fault      sed -n "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"

Example (from the build of sed itself!):
./configure: line 1497: 17680 Segmentation fault      sed -n "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"

The biggest problem is, that now even sed can't be build. Dependencies on oneself aren't that nice ;-)



emerge info:
peggy ~ # emerge info
Portage 2.0.51-r15 (default-linux/ppc/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-pegasos-r2-pegasos ppc)
=================================================================
System uname: 2.6.10-pegasos-r2-pegasos ppc 7447/7457, altivec supported
Gentoo Base System version 1.6.9
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Feb 25 2005, 01:29:48)]
dev-lang/python:     2.3.5
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.7.9-r1, 1.6.3, 1.4_p6, 1.9.4, 1.8.5-r3
sys-devel/binutils:  2.15.90.0.3-r4
sys-devel/libtool:   1.5.10-r5
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="ppc ~ppc"
AUTOCLEAN="yes"
CFLAGS="-O2 -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -ftracer -funit-at-a-time -pipe"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -ftracer -funit-at-a-time -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://ftp.uni-erlangen.de/mirrors/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aalib acl adns alsa altivec apache2 arts bash-completion berkdb bitmap-fonts cdr chroot crypt cups curldivx4linux dvb dvd dvdr emboss encode esd evo exif f77 fam flac font-server fortran ftp gdbm gif gnome gphoto2gpm gstreamer gtk gtk2 hardened imagemagick imap imlib innodb ipv6 jabber jack java jpeg kde kdeenablefinal ldap libwww mad maildir memlimit mng motif mozilla mysql nas ncurses nls nptl offensive oggvorbis openal opengl oscar oss pam pcre pda perl php pic pie png posix ppc ppds prelude python qt readline recode samba scanner sdl shared sharedmem snmp sockets socks5 sqlite ssl svg sysvipc tcpd tetex theora tiff truetype truetype-fonts type1-fonts usb vhosts xine xinerama xml2 xosd xprint xv xvid zlib video_cards_radeon linguas_de"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS

(Please don't be surprised because of Gnome AND KDE flags. The PPC is my playground where I like to look at everything ;-) )
Comment 1 meyerm 2005-02-28 06:25:47 UTC
Oh, could someone please tell my why that flag is default in PPC make.conf? Does it make other problems? I will restart my update-world, this time without that flag and hopefully don't break anything other ;-)
Comment 2 Joe Jezak (RETIRED) gentoo-dev 2005-03-05 00:44:01 UTC
You don't need -funit-at-a-time, it's redundant with -O2.  I also can't replicate the segfaults you're experiencing (I have my entire system compiled with -fno-strict-aliasing), but I feel like I've seen the problem before.  The only real difference from my setup that you've got is that you're using -ftracer which shouldn't be a problem.  I do have to ask if you're using kernel preemption.  If you've got that enabled, please turn it off as it can cause random segfaults such as this.

As for why we've got -fno-strict-aliasing on as default, we had a number of issues  with miscompilation with gcc 3.3.3 without it.  I'm not knowledgable about the current state of things to know if we still need that flag, but to my knowledge, it shouldn't hurt.  If anyone else wants to chime in and clarify, feel free.
Comment 3 meyerm 2005-03-05 02:01:26 UTC
> You don't need -funit-at-a-time, it's redundant with -O2. 
Whoops - thanks. Don't know why I used it. I got several CFLAGS
(commented out) and my original/old ones don't have that flag. Perhaps I simply copied it out of someones make.conf without reading the manual again...

> The only real difference from my setup that you've got is that
> you're using -ftracer which shouldn't be a problem.
Yes, since it works with that flag. And it is also not the combination, since it also segfaults when I use -no-strict-aliasing only.

> I do have to ask if you're using kernel preemption.
I haven't. Please note, that the segfault of sed was the only problem I encountered and I was deterministic/reproducable.

Perhaps it helps (even though I don't believe it ;-) ) if I mention the following: The system was once set up with -fstack-protector. But since I got segfaults and problems with sooo many programs and nobody could help (hey, really no stack-protector-users on PPC?) I decided that using a PPC shall be enough protection for now ;-). But some libs and/or programs which weren't updated for a long time could still be "protected".
Comment 4 meyerm 2005-03-05 02:03:17 UTC
OK, _it_ was deterministic...

Ah... Simply ignore my english please. ;-p
Comment 5 Joe Jezak (RETIRED) gentoo-dev 2005-03-05 05:36:58 UTC
Aparently it was a stuffed up sed causing the problems, once replaced from a binary the issue was fixed.  Niv, feel free to reopen the bug if it happens again.