Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 94500 - Code generated with gcc-3.3.5.20050130-r1 (hardened) crashes
Summary: Code generated with gcc-3.3.5.20050130-r1 (hardened) crashes
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-30 06:52 UTC by Pawel Marciniak
Modified: 2006-01-05 18:40 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 Pawel Marciniak 2005-05-30 06:52:19 UTC
Compiled C++ programs segfault on STL operations such as next_permutation()

I've found it when working with vector<int> - the program crashes at
next_permutation(b.begin(), b.end());

When doing
next_permutation(a, a+2);
where a is an ordinary array, everything is OK.

I'm sure the source code is ok, I've tested it on other systems and it doesn't
crash.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




See the forum topic on this issue: http://forums.gentoo.org/viewtopic-t-340971.html

What's interesting, the code is generated correctly with -O flag, but when I use
a set of separate compiler flags, noted as equivalent to -O in `man gcc`, it
still crashes.


Output from g++ -v:

Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/specs
Configured with:
/multimedia/portage_temp/portage/gcc-3.3.5.20050130-r1/work/gcc-3.3.5/configure
--enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3.5-20050130
--includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/info
--with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3
--host=i686-pc-linux-gnu --disable-altivec --disable-nls --with-system-zlib
--disable-checking --disable-werror --disable-libunwind-exceptions
--disable-multilib --disable-libgcj --enable-languages=c,c++ --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.3.5-20050130 (Gentoo Hardened 3.3.5.20050130-r1,
ssp-3.3.5.20050130-1, pie-8.7.7.1)


Output from emerge info:

Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.4.20041102-r1, 2.6.11.9 i686)
=================================================================
System uname: 2.6.11.9 i686 mobile AMD Athlon(tm) XP2400+
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 23 2005, 10:01:30)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-mcpu=athlon-xp -march=athlon-xp -mmmx -m3dnow -msse -O3 -pipe"
CHOST="i686-pc-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
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-mcpu=athlon-xp -march=athlon-xp -mmmx -m3dnow -msse -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.prz.rzeszow.pl
http://212.219.247.10/sites/www.ibiblio.org/gentoo/
http://212.219.247.12/sites/www.ibiblio.org/gentoo/
http://212.219.247.11/sites/www.ibiblio.org/gentoo/
http://212.219.247.13/sites/www.ibiblio.org/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/multimedia/portage_temp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 #profile 3dnow X Xaw3d a52 aac aalib acpi alsa apache2 audiofile avi
bash-completion bcmath bindist bitmap-fonts bonobo bzlib cdb cdparanoia cdr co
cpdflib crypt cscope ctype cups dbase dio directfb divx4linux dvd dvdread emboss
encode ethereal evo exif expat fbcon ffmpeg fftw flac foomaticdb ftp geoip ggi
gif ginac glut gmp gnome gnutls gpm gstreamer gtk gtk2 gtkhtml hal hardened
hardenedphp howl iconv imagemagick imap imlib ipv6 jabber jack java jest? jikes
jpeg junit kdeenablefinal kerberos krb4 lcms ldap lesstif libcaca libedit libgda
libwww lm_sensors mad matroska memlimit mhash mikmod mime mmap mmx mng mozilla
mp3 mpeg mpi nas ncurses neXt netcdf nptl offensive ogg oggvorbis openal opengl
osc pam pcmcia pdflib pic png portaudio posix ppds quicktime readline recode
samba sasl sdl sharedmem shorten slang slp sndfile snmp sockets sox speex spell
sse ssl svg svga symlink sysvipc szip tcpd theora threads tidy tiff to truetype
truetype-fonts type1-fonts unicode usb v4l vcd videos vorbis wifi win32codecs
wmf wxwindows xface xml xml2 xmms xosd xpm xprint xsl xv xvid zlib
video_cards_radeon userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 1 solar (RETIRED) gentoo-dev 2005-05-30 08:31:27 UTC
hrmm vector..
This has come up before.
Oddly this code when compiled with ssp-all and -O0 will cause a segfault but
only on glibc hosts other libc's seem to be fine.

#include <vector>
#include <algorithm>
int main() {
	std::vector<long> i;
	i.push_back(4);
	i.push_back(3);
	i.push_back(2);
	i.push_back(1);
	std::sort(i.begin(), i.end());
}

For now can you try to back your ssp aggressions down or bring of optimization up.

CFLAGS="-stuff"
CXXFLGAS="${CFLAGS} -fno-stack-protector-all"
or CXXFLAGS="${CFLAGS} -O[1-3]"

The profile itself uses -O2
Comment 2 solar (RETIRED) gentoo-dev 2006-01-05 18:40:41 UTC
No feedback from user. Resolving as UPSTREAM as vector has been a problem for a while now and we are not likely to see a fix till >=gcc-4.1