Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

error: ‘__chash’ may be used uninitialized when building on Fedora 39/gcc 13.2.1 #13

@alext-w

Description

@alext-w

I haven't tested this on other OS/gcc versions, so the fact it has to do with gcc version is only a guess at this point that needs additional investigation. I don't remember seeing this on Fedora 38 though (don't recall the gcc version there, but can clarify if needed).

Full build log is attached at the end of this record, but the essence is:

inlined from ‘void Image(LEVEL_CORE::IMG, void*)’ at CECTraceTool.cpp:224:20:
/home/user/dev/pin_cec/pin-3.30-98830-g1d7b601b3-gcc-linux/extras/cxx/include/memory:1872:26: error: ‘__chash’ may be used uninitialized [-Werror=maybe-uninitialized]
 1872 |     return __ptr_.first()[__i];
      |            ~~~~~~~~~~~~~~^
In file included from /home/user/dev/pin_cec/pin-3.30-98830-g1d7b601b3-gcc-linux/extras/cxx/include/unordered_map:435,
                 from CECTraceTool.cpp:13:
/home/user/dev/pin_cec/pin-3.30-98830-g1d7b601b3-gcc-linux/extras/cxx/include/__hash_table: In function ‘void Image(LEVEL_CORE::IMG, void*)’:
/home/user/dev/pin_cec/pin-3.30-98830-g1d7b601b3-gcc-linux/extras/cxx/include/__hash_table:2076:12: note: ‘__chash’ was declared here
 2076 |     size_t __chash;
      |            ^~~~~~~
cc1plus: all warnings being treated as errors

A simple workaround to make it build is to use the "ignore" GCC pragma before the line in question. It of course is not a solution but just to illustrate the way to make it build again for debugging purposes.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
  gImageMap->insert(std::make_pair(imgName, (uint64_t)IMG_LoadOffset(img)));
#pragma GCC diagnostic pop

Full build log:
maybe-uninitialized-err.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageNeeds triage to confirm and define the category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions