warning: ‘__builtin_memset’ specified size between 18446744071562067968 and 184467440737095516 15 exceeds maximum object size 9223372036854775807

Bug #1974069 reported by Steve Langasek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-11 (Ubuntu)
New
Undecided
Unassigned

Bug Description

The scotch autopkgtest is failing on ppc64el in kinetic because the compiler is outputting a warning to stderr:

[...]
mpicc -O3 -fPIC -I. -I/usr/include/metis -Drestrict=__restrict -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_FILE_COMPRESS_BZ2 -DCOMMON_FILE_COMPRESS_LZMA -DSCOTCH_PTHREAD -DCOMMON_PTHREAD -DSCOTCH_PTHREAD_NUMBER=2 -DCOMMON_PTHREAD_FILE -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -I/usr/include/scotch -L/usr/lib/powerpc64le-linux-gnu test_scotch_graph_induce.c -o test_scotch_graph_induce -lscotch -lscotcherr -lm
In file included from /usr/include/string.h:535,
                 from test_scotch_graph_induce.c:59:
In function 'memset',
    inlined from 'main' at test_scotch_graph_induce.c:134:3:
/usr/include/powerpc64le-linux-gnu/bits/string_fortified.h:59:10: warning: '__builtin_memset' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   59 | return __builtin___memset_chk (__dest, __ch, __len,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 | __glibc_objsize0 (__dest));
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]

  (https://autopkgtest.ubuntu.com/results/autopkgtest-kinetic/kinetic/ppc64el/s/scotch/20220509_164658_7d31d@/log.gz)

Reproducible when invoking gcc directly instead of via the mpicc wrapper; also reproducible with gcc -O2 instead of gcc -O3.

This warning is patently nonsense. The size ranges listed is, in hex, 0xFFFFFFFF80000000-0xFFFFFFFFFFFFFFFF. We are not trying to memset an object of that size, and at runtime there is no problem with the actual behavior.

So something is wrong with gcc's calculation here, resulting in a spurious warning.

This issue was not reproduced when the autopkgtest ran on ppc64el in Debian. I don't know why, as the compiler should be essentially the same between Debian and Ubuntu - and I've ruled out this being a problem of the -O3 default that exists in Ubuntu packaging but not in Debian.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.