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 785438 - Spurious -Wmaybe-uninitialized in gdatetime.c
Spurious -Wmaybe-uninitialized in gdatetime.c
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-07-26 09:33 UTC by Debarshi Ray
Modified: 2017-07-26 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdatetime: Silence -Wmaybe-uninitialized (1.33 KB, patch)
2017-07-26 09:34 UTC, Debarshi Ray
none Details | Review
gdatetime: Silence -Wmaybe-uninitialized (1.34 KB, patch)
2017-07-26 09:35 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-07-26 09:33:36 UTC
GCC 6.3.1 thinks that tmp is being uninitialized:
  gdatetime.c: In function ‘format_ampm’:
  gdatetime.c:2248:7: warning: ‘tmp’ may be used uninitialized in this
    function [-Wmaybe-uninitialized]
         g_free (tmp);
         ^~~~~~~~~~~~

It is not an actual problem because the code in question is guarded by "if (!locale_is_utf8)" and "#if defined (HAVE_LANGINFO_TIME)", and it does get initialized under those circumstances. Still, it might be worth fixing it to have a cleaner build and having actual problems stand out more prominently.
Comment 1 Debarshi Ray 2017-07-26 09:34:39 UTC
Created attachment 356408 [details] [review]
gdatetime: Silence -Wmaybe-uninitialized
Comment 2 Debarshi Ray 2017-07-26 09:35:46 UTC
Created attachment 356409 [details] [review]
gdatetime: Silence -Wmaybe-uninitialized

Fix a typo in the commit message.
Comment 3 Colin Walters 2017-07-26 13:04:02 UTC
Review of attachment 356409 [details] [review]:

Sure.
Comment 4 Debarshi Ray 2017-07-26 16:14:40 UTC
Comment on attachment 356409 [details] [review]
gdatetime: Silence -Wmaybe-uninitialized

Pushed to master. Thanks.