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 750566 - goom: FTBFS: possible uninitialized variables compiler warning
goom: FTBFS: possible uninitialized variables compiler warning
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.5.1
Other Linux
: Normal normal
: 1.5.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-08 14:22 UTC by Chris
Modified: 2015-06-08 22:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix FTBFS (567 bytes, patch)
2015-06-08 14:22 UTC, Chris
none Details | Review
alternative patch (398 bytes, patch)
2015-06-08 16:34 UTC, Luis de Bethencourt
committed Details | Review

Description Chris 2015-06-08 14:22:46 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.
Comment 1 Chris 2015-06-08 14:26:58 UTC
Aagghh! My message above was about a plugins-good buuild failure not plugins-base. Sorry!
Comment 2 Luis de Bethencourt 2015-06-08 14:47:15 UTC
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!
Comment 3 Chris 2015-06-08 15:09:22 UTC
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
Comment 4 Luis de Bethencourt 2015-06-08 16:34:03 UTC
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! :)
Comment 5 Luis de Bethencourt 2015-06-08 16:34:23 UTC
Created attachment 304794 [details] [review]
alternative patch
Comment 6 Chris 2015-06-08 19:38:54 UTC
Thanks Luis. Your patch fixes the build failure.
Comment 7 Luis de Bethencourt 2015-06-08 22:08:19 UTC
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