Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 173703 - dev-util/jam-2.5-r3 segfault w/ GCC-4.2 due to strict aliasing violation
Summary: dev-util/jam-2.5-r3 segfault w/ GCC-4.2 due to strict aliasing violation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Ryan Hill (RETIRED)
URL:
Whiteboard:
Keywords: PMASKED
: 181139 181519 (view as bug list)
Depends on: 213581
Blocks: gcc-4.2
  Show dependency tree
 
Reported: 2007-04-07 21:42 UTC by Ryan Hill (RETIRED)
Modified: 2008-06-30 23:56 UTC (History)
8 users (show)

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 Ryan Hill (RETIRED) gentoo-dev 2007-04-07 21:42:11 UTC
>>> Compiling source in /var/tmp/portage/dev-util/jam-2.5-r3/work/jam-2.5 ...
cc -o ./jam0 -O2 -g -march=prescott -fomit-frame-pointer -fno-ident -pipe -fweb builtins.c command.c compile.c execunix.c execvms.c expand.c filent.c fileos2.c fileunix.c filevms.c glob.c hash.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c timestamp.c variable.c
execunix.c: In function 'execcmd':
execunix.c:235: warning: incompatible implicit declaration of built-in function '_exit'
./jam0
make: *** [all] Segmentation fault

!!! ERROR: dev-util/jam-2.5-r3 failed.
Call stack:
  ebuild.sh, line 1614:   Called dyn_compile
  ebuild.sh, line 971:   Called qa_call 'src_compile'
  ebuild.sh, line 44:   Called src_compile
  jam-2.5-r3.ebuild, line 32:   Called die

!!! (no error message)
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/dev-util/jam-2.5-r3/temp/build.log'.


This is:
gcc version 4.2.0-pre20070405  (prerelease) (rev. 123536)

Working:
gcc version 4.1.3-pre20070302  (prerelease) (rev. 122594)


Portage 2.1.2.3 (default-linux/x86/2006.1/desktop, gcc-4.2.0-pre20070405, glibc-2.5-r1, 2.6.20.4 i686)
=================================================================
System uname: 2.6.20.4 i686 Genuine Intel(R) CPU T2300 @ 1.66GHz
Gentoo Base System release 1.12.10
Timestamp of tree: Unknown
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r6
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17, 2.17.50.0.14
sys-devel/gcc-config: 1.3.15-r1
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.20-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -g -march=prescott -fomit-frame-pointer -fno-ident -pipe -fweb"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -g -march=prescott -fomit-frame-pointer -fno-ident -pipe -fweb"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests autoaddcvs ccache collision-protect cvs digest distlocks fixpackages metadata-transfer parallel-fetch sandbox sfperms splitdebug strict userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://gentoo.chem.wisc.edu/gentoo/"
LANG="C"
LC_ALL="C"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu"
LINGUAS="en en_GB en_US"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/home/dirtyepic/overlay"
SYNC="cvs://dirtyepic@cvs.gentoo.org:/var/cvsroot"
USE="X a52 aac acpi alsa audiofile bash-completion berkdb bzip2 cairo calendar caps cddb cdparanoia cdr cpudetection crypt cscope curl dbus dri dts dvd dvdr dvdread encode exif expat fam ffmpeg fftw flac gdbm gif gmp gnutls graphviz gtk hal imagemagick imap imlib java javascript jikes jpeg kde kdeenablefinal kdehiddenvisibility libsamplerate logrotate mad maildir mailwrapper mbox mmap mmx mng mp3 mpeg mplayer ncurses nntp nptl nsplugin odbc ogg opengl oss pam pcre pdf perl pic png pulseaudio python qt3 quicktime readline ruby sasl sdl session sndfile spell sqlite sqlite3 sse sse2 ssl startup-notification svg tcl tcpd test theora threads truetype unicode urandom usb vcd vim-syntax vorbis win32codecs wxwindows x264 x86 xine xml xpm xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="joystick mouse keyboard synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_GB en_US" USERLAND="GNU" VIDEO_CARDS="fglrx radeon"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2007-05-13 20:12:56 UTC
(gdb) file jam0
Reading symbols from
/var/tmp/portage/dev-util/jam-2.5-r3/work/jam-2.5/jam0...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /var/tmp/portage/dev-util/jam-2.5-r3/work/jam-2.5/jam0

Program received signal SIGSEGV, Segmentation fault.
0x0804bf3d in hashitem (hp=0x805f2e0, data=0xbffb2588, enter=1) at
hash.c:108
108 keyval = *b;
(gdb) bt
#0 0x0804bf3d in hashitem (hp=0x805f2e0, data=0xbffb2588, enter=1) at
hash.c:108
#1 0x0804f279 in newstr (string=0x50891424 <Address 0x50891424 out of
bounds>) at newstr.c:52
#2 0x08050a41 in addsettings (head=0x0, setflag=0, symbol=0x50891424
<Address 0x50891424 out of bounds>, value=0x80a4168) at rules.c:253
#3 0x0804a08a in evaluate_rule (rulename=0x8060520 "Depends",
args=0xbffb2614, result=0x0) at compile.c:586
#4 0x0804a307 in compile_rule (parse=0x807cd80, args=0xbffb2684,
jmp=0xbffb26ac) at compile.c:518
#5 0x08049933 in compile_rules (parse=0x80a1490, args=0xbffb2684,
jmp=0xbffb26ac) at compile.c:630
#6 0x0804f59a in parse_file (f=0x8058150 "+") at parse.c:59
#7 0x0804c966 in main (argc=-1074056776, argv=0x0, arg_environ=0x3) at
jam.c:336
Comment 2 Simon Holm Thøgersen 2007-05-16 19:34:55 UTC
I just tried this with gcc-4.2.0, and got similar result. My backtrace looks like this

#0  0x0804a13c in evaluate_rule (rulename=0x805f660 "Always", args=0xbffce6c4, 
    result=0x0) at compile.c:586
        s = (SETTINGS *) 0x0
        jmp = 0
        l = (LIST *) 0x1
        i = 1
        rule = (RULE *) 0x80626e8
#1  0x0804a3e3 in compile_rule (parse=0x807b430, args=0xbffce730, 
    jmp=0xbffce758) at compile.c:518
        nargs = {{count = 1, list = {0x80a0408, 0x80a03d0, 0x809fe18, 0x0, 
      0x0, 0x80499e7, 0x0, 0xbffce730, 0x809fe18}}}
        result = (LIST *) 0x0
        ll = (LIST *) 0x80a0428
        l = (LIST *) 0x80a0428
        p = <value optimized out>
#2  0x08049978 in compile_rules (parse=0x809f268, args=0xbffce730, 
    jmp=0xbffce758) at compile.c:630
        result = <value optimized out>
#3  0x0804f4a7 in parse_file (f=0x8057d70 "+") at parse.c:59
        l = {count = 0, list = {0x8062bb8, 0xbffce768, 0x804977e, 0x8049180, 
    0x0, 0x0, 0x0, 0x0, 0x0}}
        p = (PARSE *) 0x809fb50
        jmp = 0
#4  0x0804c946 in main (argc=0, argv=0xbffcf268, arg_environ=0x80a03d0)
    at jam.c:336
[..]

It only happens with -O2 that is doing something fishy, for some reason l is set to 1 instead of 0. i also shows as being set to 1 in the backtrace, but when doing a printf of its value inside the loop it gives 0 as expected. Works fine without -02.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2007-05-16 20:40:54 UTC
thanks, that helped.  this is a strict aliasing bug.  -fno-strict-aliasing will work around it for now, but i'll look for a better solution.
Comment 4 SpanKY gentoo-dev 2007-05-17 16:31:36 UTC
strict aliasing violation -> jam sucks, not gcc
Comment 5 SpanKY gentoo-dev 2007-06-09 22:41:40 UTC
*** Bug 181139 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-06-10 10:05:29 UTC
*** Bug 181519 has been marked as a duplicate of this bug. ***
Comment 7 Ryan Hill (RETIRED) gentoo-dev 2007-06-10 19:13:26 UTC
i've added ftjam to the tree.  it should be 100% compatible with jam and has been reworked not to break strict-aliasing rules so it builds with GCC 4.2.  i'd like to replace jam with it eventually since it's actually maintained upstream.
Comment 8 Richard Connon 2007-06-27 23:45:03 UTC
Surely the introduction of the replacement package means this bug is resolved.
Comment 9 Ryan Hill (RETIRED) gentoo-dev 2007-06-28 01:06:22 UTC
jam still segfaults w/ gcc 4.2 -fstrict-aliasing, so no.
Comment 10 Richard Connon 2007-06-30 10:40:30 UTC
(In reply to comment #9)
> jam still segfaults w/ gcc 4.2 -fstrict-aliasing, so no.
> 

But jam is unmaintained so surely can be removed from the tree in favour of ftjam, it being 100% compatible.
Comment 11 SpanKY gentoo-dev 2007-06-30 11:20:06 UTC
no, not until ftjam is in the same KEYWORD state as jam
Comment 12 Benedikt Morbach 2007-11-19 16:40:05 UTC
What about stabilizing ftjam? Should I open a new report for that or is it enough to ask here?

As far as I can see it is in the tree since 10. Jun 2007 and it has no open bugs.
Is there any reason for it beeing in ~x86 and not x86?
Comment 13 Mark Loeser (RETIRED) gentoo-dev 2007-11-19 19:32:59 UTC
We need it to have the same keyword status across all arches before we can punt it.  So, we'll need:

~amd64
~hppa
~ppc
ppc64
~ppc-macos
sparc

Also, it looks like a final release came out, so we probably want to put that into the tree and get that marked as stable (and testing before that).  I'll leave that up to dirtyepic to decide though.
Comment 14 Ryan Hill (RETIRED) gentoo-dev 2007-11-20 00:57:46 UTC
yes, i've been unbelievably lazy about this.  i need to file a bug to get ebuilds to depend on || (dev-util/jam dev-util/ftjam), then reopen the keywording bug i filed a while back.

i'll try to get to it soon.
Comment 15 Jakub Moc (RETIRED) gentoo-dev 2008-03-16 14:14:45 UTC
Hmmm...

Keywords for dev-util/ftjam:

          | a a a h i m m p p s s s s x x 
          | l m r p a 6 i p p 3 h p p 8 8 
          | p d m p 6 8 p c c 9   a a 6 6 
          | h 6   a 4 k s   6 0   r r   - 
          | a 4             4     c c   f 
          |                         -   b 
          |                         f   s 
          |                         b   d 
          |                         s     
          |                         d     
----------+------------------------------
2.5.3_rc2 |   ~           ~ ~     ~   ~   

Keywords for dev-util/jam:

       | a a a h i m m p p s s s s x x 
       | l m r p a 6 i p p 3 h p p 8 8 
       | p d m p 6 8 p c c 9   a a 6 6 
       | h 6   a 4 k s   6 0   r r   - 
       | a 4             4     c c   f 
       |                         -   b 
       |                         f   s 
       |                         b   d 
       |                         s     
       |                         d     
-------+------------------------------
2.5    |   +           +           +   
2.5-r3 |   ~   ~       + +     +   +   

Comment 16 Stephen E. Baker 2008-03-17 20:38:52 UTC
At this point the keyword status for ftjam  >= the keyword status for jam in all cases except hppa.  Is that going to block this?
Comment 17 Ryan Hill (RETIRED) gentoo-dev 2008-03-17 23:55:25 UTC
no, hppa decided they don't need it keyworded.  i've package masked jam and will be removing it after April 16.
Comment 18 Jan Simons 2008-06-02 04:27:41 UTC
As games-simulation/lincity-ng depends on jam the lincity-ng ebuild should be updated to ftjam before jam is actually removed from the tree.
Comment 19 Jan Simons 2008-06-02 04:36:37 UTC
Sorry to spam this bug any further, but actually lincity-ng is already accepting ftjam. But as lincity-ng-1.1.2.ebuild is also referencing jam I was mislead. It would be best to revove jam in there, too.
Comment 20 Ryan Hill (RETIRED) gentoo-dev 2008-06-30 23:56:05 UTC
Removed.