Re: [PATCH] Use correct type for glibc.malloc.perturb in tst-tunconf1.c

Stefan Liebler <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
On 7/12/26 14:56, Andreas K. Huettel wrote:
> Am Samstag, 11. Juli 2026, 01:35:30 Japanische Normalzeit schrieb DJ Delorie:
>> Stefan Liebler <[email protected]> writes:
>>> According to elf/dl-tunables.list, glibc.malloc.perturb is of type
>>> int32_t (4byte) and not size_t (8byte) which was used for
>>> TUNABLE_GET_FULL inside the testcase.  Therefore the correct 32bit
>>> value 0x2a=42 is written to the to the wrong place and leads to the
>>> comparison failure.
>>
>> I'm wondering how it passed for me...  does it only show up on MSB systems?
> 
> I only saw it on s390x too.
> 
I didn't saw it on x86_64 because there the other half was by chance 0x0.

>>
>>> +  printf("perturb is %d (should be 42, from /etc)\n",
>>> +	 perturb);
>>
>> Do we know that %d matches int32_t on all platforms?  Or should we cast
>> this to (int) ?
> 
> Best I could find in a draft of the C standard floating on the internets, 
> in the section on fprintf %d is specified to be of type int.
> 
> Which is, to my best knowledge, 32bit everywhere we can run Linux.
> 
I've just sent a V2 of this patch using PRId32 and also used %zu for the
other size_t values.

Please have a look:
https://inbox.sourceware.org/libc-alpha/[email protected]/T/#u

Thanks,
Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.