GNOME Bugzilla – Bug 750566
goom: FTBFS: possible uninitialized variables compiler warning
Last modified: 2015-06-08 22:08:37 UTC
Created attachment 304771 [details] [review] Patch to fix FTBFS plugins-base build fails with the latest snapshot of gcc-4.9 brecause of possible uninitialised variables. This would normally be a warning, but warnings are being treated as errors. Patch to fix is attached.
Aagghh! My message above was about a plugins-good buuild failure not plugins-base. Sorry!
Hi Chris, Does gcc-4.9 complain about the variables declared in lines 706-708 as well? Mind pasting here the build error log? Thanks!
Relevant part of build log: make -C goom make[3]: Entering directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst/goom' CC libgstgoom_la-gstgoom.lo CC libgstgoom_la-drawmethods.lo CC libgstgoom_la-sound_tester.lo CC libgstgoom_la-mathtools.lo CC libgstgoom_la-lines.lo CC libgstgoom_la-ifs.lo CC libgstgoom_la-surf3d.lo CC libgstgoom_la-tentacle3d.lo CC libgstgoom_la-v3d.lo CC libgstgoom_la-convolve_fx.lo CC libgstgoom_la-flying_stars_fx.lo CC libgstgoom_la-plugin_info.lo CC libgstgoom_la-goom_tools.lo CC libgstgoom_la-config_param.lo CC libgstgoom_la-filters.lo CC libgstgoom_la-goom_core.lo goom_core.c: In function 'goom_update': goom_core.c:685:5: error: 'param2' may be used uninitialized in this function [-Werror=maybe-uninitialized] goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude, couleur); ^ goom_core.c:684:5: error: 'param1' may be used uninitialized in this function [-Werror=maybe-uninitialized] goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude, couleur); ^ cc1: all warnings being treated as errors Makefile:838: recipe for target 'libgstgoom_la-goom_core.lo' failed make[3]: *** [libgstgoom_la-goom_core.lo] Error 1 make[3]: Leaving directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst/goom' Makefile:850: recipe for target 'goom' failed make[2]: *** [goom] Error 2 make[2]: Leaving directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst' Makefile:694: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1' Makefile:622: recipe for target 'all' failed make: *** [all] Error 2
Very interesting Chris. Thanks for the build log. The purpose of chose_a_goom_line() just above the line that Errors is to assign the values on those variables. Except the assignment of param1 and param2 happen inside switch cases, so there isn't absolute guarantee of it happening. You don't need to initialize amplitude because this variable is always written. Coverity will complain about this value being overwritten before being used if you initialize it. I think a better way to fix this is in that function. See patch attached and let me know if it works well for you. Thanks for spotting this! :)
Created attachment 304794 [details] [review] alternative patch
Thanks Luis. Your patch fixes the build failure.
Review of attachment 304794 [details] [review]: Merged. commit e56ef6bcf09516b24ec223d67fdcb7cb89c5de1e Author: Luis de Bethencourt <luis.bg@samsung.com> Date: Mon Jun 8 23:00:16 2015 +0100 goom: possible uninitialized variables warning Build fails with the latest snapshot of gcc-4.9 because param1 and param2 might possibly be used uninitialized. They are set depending on the cases of a switch statement and the compiler sees this as not a complete guarantee. Set them to 0 if the switch statement falls down to the default case. https://bugzilla.gnome.org/show_bug.cgi?id=750566#c6