intel / pin-based-cec

Pin-Based Constant Execution Checker (Pin-based CEC)
BSD 3-Clause "New" or "Revised" License
14 stars 4 forks source link

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

Open alext-w opened 2 months ago

alext-w commented 2 months ago

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