Bug 13752

Summary: Build failure due to uninitialized variable
Product: Telepathy Reporter: Luca Ferretti <elle.uca>
Component: gabbleAssignee: Guillaume Desmottes <guillaume.desmottes>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: dafydd.harries
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Luca Ferretti 2007-12-20 03:37:43 UTC
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -I.. -I.. -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/lib/dbus-1.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/loudmouth-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/telepathy-1.0 -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/lib/dbus-1.0/include -g -O2 -MT tubes-channel.lo -MD -MP -MF .deps/tubes-channel.Tpo -c tubes-channel.c  -fPIC -DPIC -o .libs/tubes-channel.o
cc1: warnings being treated as errors
tubes-channel.c: In function 'create_new_tube':
tubes-channel.c:402: warning: 'tube' may be used uninitialized in this function
make[3]: *** [tubes-channel.lo] Error 1
make[3]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble'
make: *** [all] Error 2

(sources grabbed from darcs with jhbuild)
Comment 1 Luca Ferretti 2007-12-20 03:44:06 UTC
Another 2 uninitalized variables:

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -I.. -I.. -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/lib/dbus-1.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/loudmouth-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/telepathy-1.0 -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/lib/dbus-1.0/include -g -O2 -MT tube-stream.lo -MD -MP -MF .deps/tube-stream.Tpo -c tube-stream.c  -fPIC -DPIC -o .libs/tube-stream.o
cc1: warnings being treated as errors
tube-stream.c: In function 'gabble_tube_stream_add_bytestream':
tube-stream.c:482: warning: 'len' may be used uninitialized in this function
tube-stream.c:479: warning: 'fd' may be used uninitialized in this function
make[3]: *** [tube-stream.lo] Error 1
make[3]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble'
make: *** [all] Error 2
Comment 2 Luca Ferretti 2007-12-20 03:47:13 UTC
Another...

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -I.. -I.. -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/lib/dbus-1.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/loudmouth-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/include/telepathy-1.0 -I/opt/gnome2/include/dbus-1.0 -I/opt/gnome2/include/glib-2.0 -I/opt/gnome2/lib/glib-2.0/include -I/opt/gnome2/lib/dbus-1.0/include -g -O2 -MT tube-stream.lo -MD -MP -MF .deps/tube-stream.Tpo -c tube-stream.c  -fPIC -DPIC -o .libs/tube-stream.o
cc1: warnings being treated as errors
tube-stream.c: In function 'gabble_tube_stream_accept':
tube-stream.c:600: warning: 'fd' may be used uninitialized in this function
make[3]: *** [tube-stream.lo] Error 1
make[3]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/luca/svn/gnome2/telepathy-gabble'
make: *** [all] Error 2
Comment 3 Guillaume Desmottes 2007-12-20 03:59:48 UTC
These variables aren't initialized because a g_assert_not_reached was reached and your compiler doesn't understand them as a return.

I'm wondering what's the best way to fix these warnings. Add a return after the g_assert_not_reached? Initialize these variables during their declarations?
Comment 4 Guillaume Desmottes 2007-12-20 04:19:39 UTC
Could you try to build this branch http://people.collabora.co.uk/~cassidy/darcs/telepathy-gabble-build-fix/ and report any other build failure please?
Comment 5 Dafydd Harries 2008-01-03 04:10:02 UTC
Which version of GCC are you using?
Comment 6 Guillaume Desmottes 2008-01-03 04:12:24 UTC
This branch is now merged to HEAD. So just relaunch your jhbuild should be
enough. Could you try please?
Comment 7 Luca Ferretti 2008-01-11 05:01:05 UTC
Sorry for the lag, I was able to take care of this only now.

I can confirm there are no more issues rebuilding from a fresh grab.

PS the gcc version is:
gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
Comment 8 Guillaume Desmottes 2008-01-11 05:14:50 UTC
cool. Closing the bug so.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.