Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55066

maybe-uninitialized warning in timelib

    • Type: Icon: Improvement Improvement
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Query Execution 2021-05-31

      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.

            Assignee:
            mohammad.dashti@mongodb.com Mohammad Dashti (Inactive)
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: