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!
Does gcc-4.9 complain about the variables declared in lines 706-708 as well? Mind pasting here the build error log?
Relevant part of build log:
make -C goom
make: Entering directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst/goom'
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: *** [libgstgoom_la-goom_core.lo] Error 1
make: Leaving directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst/goom'
Makefile:850: recipe for target 'goom' failed
make: *** [goom] Error 2
make: Leaving directory '/home/chris/rpm/BUILD/gst-plugins-good-1.5.1/gst'
Makefile:694: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
make: 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]
Thanks Luis. Your patch fixes the build failure.
Review of attachment 304794 [details] [review]:
Author: Luis de Bethencourt <firstname.lastname@example.org>
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.