This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] NSS test harness upgrade


Building with recent trunk GCC: gcc-svn-r249175, I am seeing

nss_test1.c:60:46: error: division ‘sizeof (struct passwd *) / sizeof
(struct passwd)’ does not compute the number of array elements
[-Werror=sizeof-pointer-div]
 #define default_npwd_data (sizeof (pwd_data) / sizeof (pwd_data[0]))
                                              ^
nss_test1.c:63:24: note: in expansion of macro ‘default_npwd_data’
 static int npwd_data = default_npwd_data;
                        ^~~~~~~~~~~~~~~~~
nss_test1.c:62:23: note: first ‘sizeof’ operand was declared here
 static struct passwd *pwd_data = default_pwd_data;
                       ^~~~~~~~

Same for nss_test2.c. I assume this was intended?

diff --git a/nss/nss_test1.c b/nss/nss_test1.c
index b728e418a3..55d3e456d0 100644
--- a/nss/nss_test1.c
+++ b/nss/nss_test1.c
@@ -57,7 +57,7 @@ static struct passwd default_pwd_data[] =
     PWD (60),
     PWD (20000)
   };
-#define default_npwd_data (sizeof (pwd_data) / sizeof (pwd_data[0]))
+#define default_npwd_data (sizeof (default_pwd_data) / sizeof
(default_pwd_data[0]))

 static struct passwd *pwd_data = default_pwd_data;
 static int npwd_data = default_npwd_data;




On Wed, Jul 19, 2017 at 4:15 PM, DJ Delorie <dj@redhat.com> wrote:
>
> Andreas Schwab <schwab@linux-m68k.org> writes:
>>> -  savedmemcount = (size_t) *(savedend - sizeof (size_t));
>>> +  savedmemcount = *(size_t *) (savedend - sizeof (size_t));
>>
>> I don't see where savedend is aligned.
>
> It's always a multiple of size_t away from the array we align for in
> __copy_grp, since that's where the data comes from.
>
> Unless there's *another* place where we put together that weird
> undocumented layout of the data - in which case, we shouln't ;-)



-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]