[SERVER-55066] maybe-uninitialized warning in timelib Created: 09/Mar/21  Updated: 27/Oct/23  Resolved: 24/May/21

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mohammad Dashti (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-56371 Upgrade timelib to 2021.06 Closed
is depended on by SERVER-55133 Evaluate impact of building with -O3 Closed
Sprint: Query Execution 2021-05-31
Participants:

 Description   

I saw this on gcc-10 when compiling with -O3. It doesn't show up with -O2, probably due to less aggressive inlining not making it visible to the compiler.

src/third_party/timelib-2018.01/parse_tz.c: In function 'timelib_get_time_zone_info':
src/third_party/timelib-2018.01/parse_tz.c:677:24: error: 'transition_time' may be used uninitialized in this function [-Werror=maybe-uninitialized]

It seems like a valid warning since `transition_time` won't be initialized if this return path is taken https://github.com/mongodb/mongo/blob/144e0d0f355dd5ec13a1aa135a1f59a90d234aa5/src/third_party/timelib-2018.01/parse_tz.c#L622. Initializing to 0 at https://github.com/mongodb/mongo/blob/144e0d0f355dd5ec13a1aa135a1f59a90d234aa5/src/third_party/timelib-2018.01/parse_tz.c#L671 seems to silence the warning.



 Comments   
Comment by Mohammad Dashti (Inactive) [ 24/May/21 ]

Thanks David for fixing the label to the correct one.

Comment by David Storch [ 24/May/21 ]

I have changed the resolution to "Gone Away" rather than "Fixed", since there are no commits to the code base against this ticket.

Comment by Mohammad Dashti (Inactive) [ 17/May/21 ]

Thanks redbeard0531 for reporting this and acm for double-checking it. 

This issue does not exist in the latest version of timelib, which is already upgraded via SERVER-56371. In this version, The code paths in master (and the latest 2021.06) don't have this, and in every case it is setting the transition_time to something:
https://github.com/mongodb/mongo/blob/61f662b283f983f8c498a7a5e4c0e8348b452e4d/src/third_party/timelib-2021.06/parse_tz.c#L808

Comment by Ana Meza [ 04/May/21 ]

Query will verify is this issue still exist in the latest version 

Comment by Andrew Morrow (Inactive) [ 13/Mar/21 ]

I just encountered this with toolchain v3 while evaluating -O3 for SERVER-55133 as well, so it isn't just newer GCC.

Generated at Thu Feb 08 05:35:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.