This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37001] New: Uninitialized static variables on x86_64
- From: "gerald at wireshark dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Aug 2008 16:30:54 -0000
- Subject: [Bug c/37001] New: Uninitialized static variables on x86_64
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Wireshark's Buildbot system recently uncovered what appears to be a bug in gcc.
The following code:
static guint tap_current=0;
[ ... ]
fprintf(stderr, "dissect_bssmap tap_current: %u\n", tap_current);
produces the following output:
dissect_bssmap tap_current: 2801996644
'gcc -v' output:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
(I realize this may be an Ubuntu-specific bug. Launchpad.net pointed me here.)
Steps to reproduce:
Download a recent Wireshark tarball from
http://www.wireshark.org/download/automated/src/ or check out from SVN at
http://anonsvn.wireshark.org/wireshark/trunk/
Apply the patch which I'll attach shortly and build Wireshark
Download the capture file from
http://www.wireshark.org/download/automated/captures/fuzz-2008-07-31-3587.pcap
Run './tshark -nVr /tmp/fuzz-2008-07-31-3587.pcap > /dev/null 2> /tmp/tp.out
; head -10 /tmp/tp.out'
You should see something like the following:
dissect_bssmap tap_current: 2801996644
dissect_bssmap tap_current: 0
dissect_bssmap tap_current: 1
dissect_dtap tap_current: 2801996612
dissect_bssmap tap_current: 2
dissect_dtap tap_current: 0
dissect_bssmap tap_current: 3
dissect_dtap tap_current: 1
dissect_bssmap tap_current: 0
dissect_bssmap tap_current: 1
Sorry I don't have a smaller test case.
--
Summary: Uninitialized static variables on x86_64
Product: gcc
Version: 4.1.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gerald at wireshark dot org
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37001