After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588456 - test-resizing.c incorrect code causes FTBFS with -O3
test-resizing.c incorrect code causes FTBFS with -O3
Status: RESOLVED OBSOLETE
Product: metacity
Classification: Other
Component: testing
trunk
Other All
: Normal normal
: ---
Assigned To: Thomas Thurman
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2009-07-13 15:36 UTC by Sascha Silbe
Modified: 2015-04-15 13:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix typo in test-resizing.c (665 bytes, patch)
2009-09-23 18:05 UTC, Sascha Silbe
none Details | Review

Description Sascha Silbe 2009-07-13 15:36:30 UTC
test-resizing.c contains the following code in get_size():

  if (widthp)
    *widthp = width;
  if (*heightp)
    *heightp = height;


While the widthp check correctly checks the _pointer_ for non-NULL, the heightp check is against the _value_.
gcc with -O3 catches this mistake and aborts because of -Werror:

gcc -DHAVE_CONFIG_H -I. -I../.. -D_REENTRANT -I/home/sugar/sugar-jhbuild/install/include/gconf/2 -I/home/sugar/sugar-jhbuild/install/include
/dbus-1.0 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/
include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/
dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/startup-notification-1.0 -O3 -ggdb -Wall -Wchar-subscripts -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -Wall -Werror -ansi -MT test-resizing.o -MD -MP -MF .deps/
test-resizing.Tpo -c -o test-resizing.o test-resizing.c
cc1: warnings being treated as errors
test-resizing.c: In function ‘main’:
test-resizing.c:82: error: ‘height’ is used uninitialized in this function
test-resizing.c:94: note: ‘height’ was declared here
make[4]: *** [test-resizing.o] Error 1
make[4]: Leaving directory `/home/sugar/sugar-jhbuild/source/metacity/src/wm-tester'
Comment 1 Sascha Silbe 2009-09-23 18:05:00 UTC
Created attachment 143816 [details] [review]
fix typo in test-resizing.c