<?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>140918</bug_id>
          
          <creation_ts>2006-07-18 07:29 0000</creation_ts>
          <short_desc>bzflag weird behavior with -fstrict-aliasing</short_desc>
          <delta_ts>2006-12-22 14:21:12 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>Games</component>
          <version>unspecified</version>
          <rep_platform>All</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>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>andreas@tpwch.com</reporter>
          <assigned_to>games@gentoo.org</assigned_to>
          <cc>morrison@brlcad.org</cc>

      

      
          <long_desc isprivate="0">
            <who>andreas@tpwch.com</who>
            <bug_when>2006-07-18 07:29:33 0000</bug_when>
            <thetext>I&apos;ve been having some problems with bzflag lately, that is that if I shoot someone I won&apos;t hit them, and the other persons doesn&apos;t see my shots. After googling around a bit I found this upstream bug posted over a year ago, but nothing has happened after that, so the devs must have missed it:
http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1191085&amp;group_id=3248&amp;atid=103248

The person who reported that says that it will get this weird behavior with gcc 4.0 and -O2 or -fstrict-aliasing. I have found that it also happens with -O3. And sure enough, downgrading the cflags to -O1 fixed the problem.

If the bug is caused by &gt;=-O2 implying -fstrict-aliasing then the most correct workaround would be to add -fno-strict-aliasing, otherwise I guess you&apos;ll have to filter out -O2 -O3 and -Os. I have posted a comment in the upstream bug, and hopefully it&apos;ll get some attention from the upstream developers so they can provide a proper fix

My emerge info:
Portage 2.1.1_pre3-r1 (default-linux/amd64/2006.0, gcc-4.1.1/amd64-vanilla, glibc-2.4-r3, 2.6.17-gentoo-r2-tpc1 x86_64)
=================================================================
System uname: 2.6.17-gentoo-r2-tpc1 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4400+
Gentoo Base System version 1.12.1
ccache version 2.4 [enabled]
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r2
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.16
ACCEPT_KEYWORDS=&quot;amd64 ~amd64&quot;
AUTOCLEAN=&quot;yes&quot;
CBUILD=&quot;x86_64-pc-linux-gnu&quot;
CFLAGS=&quot;-march=athlon64 -mtune=athlon64 -msse3 -O3 -pipe&quot;
CHOST=&quot;x86_64-pc-linux-gnu&quot;
CONFIG_PROTECT=&quot;/etc /usr/share/X11/xkb&quot;
CONFIG_PROTECT_MASK=&quot;/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo&quot;
CXXFLAGS=&quot;-march=athlon64 -mtune=athlon64 -msse3 -O3 -pipe&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
FEATURES=&quot;autoconfig ccache confcache distlocks fixpackages metadata-transfer parallel-fetch sandbox sfperms strict&quot;
GENTOO_MIRRORS=&quot;http://ds.thn.htu.se/linux/gentoo http://ftp.du.se/pub/os/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo&quot;
LANG=&quot;sv_SE.ISO-8859-1&quot;
LC_ALL=&quot;sv_SE.ISO-8859-1&quot;
LINGUAS=&quot;sv&quot;
MAKEOPTS=&quot;-j3&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_RSYNC_OPTS=&quot;--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=&apos;/distfiles&apos; --exclude=&apos;/local&apos; --exclude=&apos;/pac
kages&apos;&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/usr/portage&quot;
PORTDIR_OVERLAY=&quot;/usr/local/portage&quot;
SYNC=&quot;rsync://rsync.europe.gentoo.org/gentoo-portage&quot;
USE=&quot;amd64 GAPING_SECURITY_HOLE X a52 aac aalib acpi alsa amr ao apache apache2 ares asf authfile avi bash-completion bcmath berkdb bluetooth browserplugin bzip2 cairo cddb cdparanoia cli crypt cups curl 
curlwrappers custom-cflags dbus dga dlloader dmi dri dv dvd dvdread encode faad fam ffmpeg flac fontconfig foomaticdb fortran ftp gd gdbm gif gimp glibc-omitfp glitz gnutls gphoto2 gs gtk gtk2 hal hub idn
 imagemagick inkjar iontruetype ithreads java javascript jce jpeg kqemu latin1 lcms libcaca libg++ live logitech-mouse logrotate lua mad mikmod mmap mng modplug mp3 mp4 mpeg musepack musicbrainz mysql ncu
rses nls noflagstrip nptl nptlonly nsplugin nvidia offensive ogg opengl opensslcrypt pam panel-plugin parse-clocks pcre pda pdf pdflib perl pg-intdatetime php png pwdb python quicktime rdesktop readline r
ewrite rtc ruby sasl scanner sdl session shaper simplexml slang smp sockets speex spell sql ssl subversion svg symlink syslog theora threads thumbnail thunar-vfs tiff timidity truetype truetype-fonts type
1-fonts udev usb vcd vchroot vim-pager vim-with-x vorbis vroot wxwindows x264 xanim xcomposite xml xml2 xorg xpm xv xvid xvmc zip zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux l
inguas_sv userland_GNU video_cards_nv video_cards_nvidia&quot;
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>andreas@tpwch.com</who>
            <bug_when>2006-07-18 07:40:48 0000</bug_when>
            <thetext>*** Bug 140919 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-07-19 19:00:58 0000</bug_when>
            <thetext>bzflag itself should fix its code or force -fno-strict-aliasing in their build system

in the meantime, an &apos;append-flags -fno-strict-aliasing&apos; in the ebuild should be ok</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>morrison@brlcad.org</who>
            <bug_when>2006-10-27 13:37:22 0000</bug_when>
            <thetext>This is a relatively recently introduced issue related to IEEE floating point operations going on in the code that haven&apos;t yet been isolated.  I believe that if you add -mieee or a similar IEEE compliance option that you can then proceed to use any -O# optimization level desired.

one of the bzflag devs</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>morrison@brlcad.org</who>
            <bug_when>2006-10-27 13:54:02 0000</bug_when>
            <thetext>It&apos;s also probably worth mentioning that there was a separate issue in the networking protocol that affected (only some) 64-bit platforms that caused similar inabilities to shoot other players that has been fixed in the latest CVS sources but not yet pushed out via a public release.

The next public release isn&apos;t scheduled until around the end of the calendar year.  If, however, someone (tm) can work with the user experiencing this problem to determine if it&apos;s the ieee or 64-bit issue and it&apos;s issue that folks would like to see fixed earlier rather than later, then a patch could probably be put together.  Otherwise, both of the issues should be fixed for the next release.

Cheers!
Sean</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-10-27 22:46:09 0000</bug_when>
            <thetext>i doubt it considering -mieee is an alpha/superh specific flag

the original comment is most likely correct ... bzflag uses casting that violates ISO spec for aliasing and now that gcc-4 enables strict-aliasing by default with -O2, people are noticing</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>tupone@gentoo.org</who>
            <bug_when>2006-12-22 14:21:12 0000</bug_when>
            <thetext>A fix is now in portage. Thanks for report</thetext>
          </long_desc>
      
    </bug>

</bugzilla>