[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: latest gcc.git vs latest coreutils.git
From: |
Pádraig Brady |
Subject: |
Re: latest gcc.git vs latest coreutils.git |
Date: |
Wed, 20 Dec 2017 11:46:11 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 20/12/17 05:25, Jim Meyering wrote:
> I built the very latest gcc from git:
>
> gcc version 8.0.0 20171219 (experimental) (GCC)
>
> Then used it to build latest coreutils.git configured with
> --enable-gcc-warnings. That shows that a few of gcc's new
> warnings trigger in latest coreutils and gnulib.
>
> I haven't looked at these enough yet to say whether to accommodate or
> to suppress them:
> lib/readutmp.c: In function 'extract_trimmed_name':
> lib/readutmp.c:50:47: error: argument to 'sizeof' in 'strncpy' call is the
> same expression as the source; did you mean to use the size of the
> destination? [-Werror=sizeof-pointer-memaccess]
> strncpy (trimmed_name, UT_USER (ut), sizeof (UT_USER (ut)));
^
> src/who.c: In function 'make_id_equals_comment':
> src/who.c:96:19: error: argument to 'sizeof' in 'strncat' call is the same
> expression as the source; did you mean to use the size of the destination?
> [-Werror=sizeof-pointer-memaccess]
> # define UT_ID(U) ((U)->ut_id)
> ^
> src/who.c:453:46: note: in expansion of macro 'UT_ID'
> strncat (comment, UT_ID (utmp_ent), sizeof UT_ID (utmp_ent));
This is an incorrect and frankly confusing warning.
The sizes passed to strncpy() and strncat() specify how much to copy from the
_source_.
They've nothing to do with the dest (unlike strlcat() for example).
This is especially erroneous as the compiler should be able to determine
sizeof dest is not useful.
Could that be directed to gcc bugzilla?
cheers,
Pádraig.