Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-12506

Fix uninitialized array warning about WT_VERBOSE_MULTI_CATEGORY

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Lint
    • Storage Engines
    • 5
    • StorEng - Defined Pipeline

      During the implementation of WT-12422 we've made a change to F_ISSET which has the downstream effect of making clang's type checking stricter. The code is functionally identical, but s_clang_scan now reports an Array subscript is undefined [core.uninitialized.ArraySubscript]warning inside the {}wt_verbose_level_multi _and }}{{_wt_verbose_multi macros.

      Tracing this back the warning comes from using multi_category.categories[__v_idx], where multicategory has been created by a call to the WT_VERB_RECOVERY_RTS macro.
      WT_VERB_RECOVERY_RTS returns one of two structs that are defined at compile time, so it can't return NULL. I think this is due to initialising the WT_VERBOSE_MULTI_CATEGORY->categories field which is of type (WT_VERBOSE_CATEGORY *) with an array {}.

      This ticket can be timeboxed and the the scope is investigating a fix. If none can be found then this ticket can be closed and we'll keep the suppressions in s_clang_scan.diff

       

      To reproduce - once WT-12422 is merged into develop - delete this line

      wiredtiger/src/rollback_to_stable/rts_btree.c Array subscript is undefined [core.uninitialized.ArraySubscript]
      

      from dist/s_clang_scan.diff and run s_clang_scan.
      Note that s_clang_scan will also fail when expected errors in s_clang_scan.diff are missing from the clang_scan output, so if you see lines in the diff that start with a < like

      < wiredtiger/src/rollback_to_stable/rts_btree.c Array subscript is undefined [core.uninitialized.ArraySubscript] 

      they just need to be deleted from s_clang_scan.diff

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            andrew.morton@mongodb.com Andrew Morton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: