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 751985 - rtph261pay: Fix uninitialized variable compiler error
rtph261pay: Fix uninitialized variable compiler error
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.5.2
Other Linux
: Normal normal
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-05 14:04 UTC by Jimmy Ohn
Modified: 2015-08-16 13:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix uninitialized variable compiler error (1.38 KB, patch)
2015-07-05 14:08 UTC, Jimmy Ohn
none Details | Review
Patch to fix compiler warning (1.15 KB, patch)
2015-07-05 17:11 UTC, Stian Selnes (stianse)
none Details | Review
Patch to fix compiler warning (1.66 KB, patch)
2015-07-06 09:45 UTC, Stian Selnes (stianse)
none Details | Review
rtph261pay: Fix uninitialized variable compiler error (1.97 KB, patch)
2015-07-06 10:24 UTC, Jimmy Ohn
none Details | Review
Fix compiler error about uninitialized variable (1.96 KB, patch)
2015-07-07 00:33 UTC, Jimmy Ohn
committed Details | Review

Description Jimmy Ohn 2015-07-05 14:04:40 UTC
when we do compile rtph261pay using jhbuild, compiler error appears.
Here is the error message.

gstrtph261pay.c: In function 'gst_rtp_h261_packetize_and_push':
gstrtph261pay.c:661:34: error: 'endpos' may be used uninitialized in this function [-Werror=uninitialized]
gstrtph261pay.c:854:11: note: 'endpos' was declared here

I want to know that compile option are changed or not in the latest version.
Comment 1 Jimmy Ohn 2015-07-05 14:08:12 UTC
Created attachment 306859 [details] [review]
Fix uninitialized variable compiler error
Comment 2 Stian Selnes (stianse) 2015-07-05 17:11:58 UTC
Created attachment 306863 [details] [review]
Patch to fix compiler warning

The previously proposed patch also removes a useful debug message. This patch should fix the warning while keeping the debug message.

This seems to be an issue with GCC not correctly understanding that the particular branch cannot be entered on the first iteration of the loop (because of the 'count' variable). Although I don't get the same warning with GCC 4.8.4 the provided patch should fix the issue.

@Jimmy: This code was recently added so the warning you get is not due to changed compiler flags.
Comment 3 Tim-Philipp Müller 2015-07-05 17:23:12 UTC
@Jimmy: Could you confirm that fixes your warning (and please also tell us the exact compiler + version you're using, 'latest compiler' is not very precise).
Comment 4 Jimmy Ohn 2015-07-05 23:43:41 UTC
@Tim and @Stian
Here is the my GCC version. sorry about that. It's not latest compiler version. :(
-> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Also, I test proposed patch from Stian in my desktop. but it's same compiler error.
Actually, I already try endpos initialization like proposed patch from Stian before attach my patch.
I agree Stian comment. maybe gcc compiler does not correctly understand that code in 4.6.3 GCC version.
Comment 5 Stian Selnes (stianse) 2015-07-06 09:45:30 UTC
Created attachment 306899 [details] [review]
Patch to fix compiler warning

This patch is basically the same as Jimmy's but keeps a modified version of the debug message in addition.

@Jimmy: Can you please verify that the fix still works for you after I added the debug message?

Btw, I was not able to reproduce with either 4.6.4 or 4.6.3. Could be some environment differences.
Comment 6 Jimmy Ohn 2015-07-06 10:24:10 UTC
@Stian
It's working for me in my GCC 4.6.3 version.
How about attached my new patch? This patch is keep the original debug message.
Comment 7 Jimmy Ohn 2015-07-06 10:24:47 UTC
Created attachment 306903 [details] [review]
rtph261pay: Fix uninitialized variable compiler error
Comment 8 Stian Selnes (stianse) 2015-07-06 11:26:53 UTC
Thanks, Jimmy. Even better would be to just move "Macroblock mb;" outside the loop instead of declaring a new Macroblock in order to avoid copying the struct. If you do that I would say the patch looks good.
Comment 9 Jimmy Ohn 2015-07-07 00:33:18 UTC
Created attachment 306967 [details] [review]
Fix compiler error about uninitialized variable

This patch is to fix compile error in GCC 4.6.3 version.

@Stian
Thanks for your comment. I upload new patch included your comment.
Comment 10 Stian Selnes (stianse) 2015-07-07 07:30:23 UTC
LGTM
Comment 11 Tim-Philipp Müller 2015-07-07 08:21:21 UTC
commit 19e7f188fa0e6fca73f8f080c315d4bbd99f708f
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Tue Jul 7 09:18:39 2015 +0100

    rtph261pay: fix indentation

commit 2f016f3f9dd4c3bbf5f5de24ab2e866466bb7a3b
Author: Jimmy Ohn <yongjin.ohn@lge.com>
Date:   Mon Jul 6 19:11:00 2015 +0900

    rtph261pay: Fix uninitialized variable compiler error
    
    endpos variable does not correctly understand in the
    4.6.3 GCC version. So compile error appears when we do
    compile rtph261pay using jhbuild.
    This patch is fixed the compile error in 4.6.3 GCC version.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751985
Comment 12 Tim-Philipp Müller 2015-07-07 08:22:39 UTC
Comment on attachment 306967 [details] [review]
Fix compiler error about uninitialized variable

>+  if(ret == PARSE_OK) {

This does not follow GStreamer indentation, make sure you have GNU indent installed, it should complain when you try to git commit locally.