This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] add attribute nonstring
On Monday 27 November 2017 09:54 PM, Siddhesh Poyarekar wrote:
> On Monday 27 November 2017 09:34 PM, Martin Sebor wrote:
>> I didn't see any warnings in my x86_64-linux build but there could
>> be others on targets I don't test. The only problem I do know of
>> (bug 22447) was fixed last Wednesday.
>>
>> It would be helpful if you could share some details about the code
>> that triggers the warning, what target, etc.
>
> I saw this during an aarch64 cross-build on an x86_64 host:
>
> In file included from ../sysdeps/unix/sysv/linux/getlogin_r.c:25:
> ../sysdeps/unix/getlogin_r.c: In function ‘getlogin_r_fd0’:
> ../sysdeps/unix/getlogin_r.c:83:23: error: ‘strlen’ argument 1 declared
> attribute ‘nonstring’ [-Werror=stringop-overflow=]
> size_t needed = strlen (ut->ut_user) + 1;
> ^~~~~~~~~~~~~~~~~~~~
> In file included from ../login/utmp.h:29,
> from ../include/utmp.h:2,
> from ../sysdeps/unix/getlogin_r.c:26,
> from ../sysdeps/unix/sysv/linux/getlogin_r.c:25:
> ../sysdeps/gnu/bits/utmp.h:65:8: note: argument ‘ut_user’ declared here
> char ut_user[UT_NAMESIZE]
> ^~~~~~~
> cc1: all warnings being treated as errors
Ugh, sorry, that is in fact the fix. I just noticed that I had not
synced to the HEAD.
Thanks,
Siddhesh