This was originally thought a bug in Git on HPPA, but it seems to be a GCC bug. Here is the smallest GCC testcase I could come up with that exhibits the issue: int ret1() { return -1 } int main(int argc, char **argv) { int i = ret1(); if(i >= -10000) { i = -i; } // should execute return i+10; } And I used it as follows: for i in 0 1 2 3 ; do hppa2.0-unknown-linux-gnu-gcc -o test2 -save-temps -Wall test2.c -O${i} && cp test2.s test2-O${i}.s && ./test2 ; echo $? ; done ; 11 9 9 11 '11' is the correct value. -O3 gives the correct value only because it converts the entire program to 'return 11'; Other systems (amd64, x86, ppc) get it correct. (I used return i+10 to avoid any side effects from a call to printf). This was on hake.hppa.dev.gentoo.org. Portage 2.1.4_rc11 (default-linux/hppa/2007.0/server, gcc-4.1.2, glibc-2.5-r4, 2.6.22.6 parisc) ================================================================= System uname: 2.6.22.6 parisc PA8600 (PCX-W+) Timestamp of tree: Thu, 27 Dec 2007 08:00:03 +0000 ccache version 2.3 [enabled] app-shells/bash: 3.2_p17 dev-lang/python: 2.4.4-r6 dev-python/pycrypto: 2.0.1-r6 dev-util/ccache: 2.3 sys-apps/baselayout: 1.12.9-r2 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.13, 2.61-r1 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.16.1-r3, 2.17, 2.17.50.0.9, 2.17.50.0.11, 2.17.50.0.12, 2.18-r1 sys-devel/gcc-config: 1.3.16 sys-devel/libtool: 1.5.24 virtual/os-headers: 2.6.23-r2 ACCEPT_KEYWORDS="hppa" CBUILD="hppa2.0-unknown-linux-gnu" CFLAGS="-march=2.0 -O2 -pipe -mschedule=8000" CHOST="hppa2.0-unknown-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-march=2.0 -O2 -pipe -mschedule=8000" DISTDIR="/usr/portage/distfiles" FEATURES="buildsyspkg ccache distlocks metadata-transfer noinfo parallel-fetch sandbox sfperms strict test unmerge-orphans userfetch" GENTOO_MIRRORS="http://gentoo.osuosl.org" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_EXTRA_OPTS="--exclude=/manifest1_obsolete" 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="/usr/local/tmp" PORTDIR="/usr/portage" SYNC="rsync://raptor.gentoo.org/gentoo-portage" USE="apache2 berkdb bitmap-fonts bzip2 cli cracklib crypt cups firefox foomaticdb fortran gdbm gpm hppa iconv imlib ipv6 isdnlog libwww mailwrapper midi mudflap multislot mysql ncurses nls nptl nptlonly openmp openntpd pcre perl pic pppd python readline reflection session snmp spell spl ssl tcpd test truetype truetype-fonts type1-fonts unicode xml xml2 xorg zlib" 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" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="dummy fbdev" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTDIR_OVERLAY
looks like gcc-4.3 and gcc-4.1 both fail have you posted a report upstream ?
Not yet, will do so tonight, unless you get to it ahead of me.
Created attachment 142667 [details, diff] Patch against 4.1.2 PR fixed upstream. Attaching patch against our gcc-4.1.2
toolchain/spanky: Could you please put this into the next spin of GCC? For both 4.1, 4.2, and 4.3 (the upstream bug has the various patches).
i thought this was fixed in the gcc-4.3.0 release ?
vapier: unless hppa is going with 4.3.x everywhere, can you apply the 4.1/4.2 versions to the tree as well?
ive added the fix to our patchset
1) It doesn't look like the patch ever made it into the set. 2) Greater versions should probably be patched as well.
i did add it to our patchset: http://sources.gentoo.org/gentoo/src/patchsets/gcc/4.1.2/gentoo/65_all_gcc-hppa-pr34627.patch?rev=1.1 but not to the ebuild ... i dont want to put out a gcc-4.1.2-r1 with only this new patch if you guys dont care, i can just add the patch to gcc-4.1.2.ebuild
sys-devel/gcc-4.2.4-r1 fixes bug #193134 ...
so, things should be in latest 4.[123].x versions ... how hppa wants to handle stabilization is up to them