lczech / grenedalf

Toolkit for Population Genetic Statistics from Pool-Sequenced Samples, e.g., in Evolve and Resequence experiments
GNU General Public License v3.0
34 stars 2 forks source link

compilation warning with gcc/12.3.0 #13

Closed douglasgscofield closed 1 year ago

douglasgscofield commented 1 year ago

It may be an overly cautious gcc 12.3.0 compiler but during a successful linking I see:

[100%] Linking CXX executable /sw/bioinfo/grenedalf/0.3.0/src/grenedalf/bin/grenedalf
In member function 'update_',
    inlined from 'update' at /sw/bioinfo/grenedalf/0.3.0/src/grenedalf/build/genesis_unity_sources/lib/all.cpp:67744:12,
    inlined from 'update' at /sw/bioinfo/grenedalf/0.3.0/src/grenedalf/build/genesis_unity_sources/lib/all.cpp:67731:15:
/sw/bioinfo/grenedalf/0.3.0/src/grenedalf/build/genesis_unity_sources/lib/all.cpp:67831:11: warning: '__builtin_memcpy' reading between 0 and 4294967295 bytes from a region of size 0 [-Wstringop-overread]
67831 |     memcpy( &buffer_[index], &input[i], length-i );
      |           ^
/sw/bioinfo/grenedalf/0.3.0/src/grenedalf/build/genesis_unity_sources/lib/all.cpp: In member function 'update':
/sw/bioinfo/grenedalf/0.3.0/src/grenedalf/build/genesis_unity_sources/lib/all.cpp:67725:10: note: at offset [65, 4294967295] into source object 'sbuf' of size 64
67725 |     char sbuf[MD5::BlockSize];
      |          ^
[100%] Built target grenedalf

Note that I build with cmake separately as I'd prefer to use non-system modules for liblzma libbz2 libdeflate and libz that we already have.

lczech commented 1 year ago

Hi @douglasgscofield,

thanks for reporting this - it is indeed an overly cautious compiler. This particular warning is a known false positive in gcc 12, see here. Not much I can do about it unfortunately. I've added a few assertions to that code now, just to be sure, but the warning won't go away from that. Also, that particular function is in a bit of code of my genesis library that is not used in grenedalf at all at the moment, so it wouldn't even show up there ;-)

Hope that helps, and let me know if you encounter any further trouble.

Cheers Lucas