Skip to content

gcc warning in range_totient #85

@hvds

Description

@hvds

gcc-9 complains about args to memset() in range_totient() from latest master:

% gcc-9 --version | head -1
gcc-9 (Ubuntu 9.2.1-17ubuntu1~18.04.1) 9.2.1 20191102
...
gcc-9 -c   -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O6   -DVERSION=\"0.73\" -DXS_VERSION=\"0.73\" -fPIC "-I/opt/mathsg-5.43.6/lib/perl5/5.43.6/x86_64-linux/CORE"   totients.c
In file included from /usr/include/string.h:494,
                 from totients.c:3:
In function 'memset',
    inlined from 'range_totient' at totients.c:91:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:10: warning: '__builtin_memset' specified bound 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The memset() was introduced in 7f6602e to replace a Newz() which probably had the same overflow potential.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions