Re: [PATCH] register_printf_speficier.3, register_printf_modifier.3, register_printf_type.3: Add new manual page and links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/19/22 00:16, Alex Colomar wrote:
And it seems I also need some help with my own example, since I
discovered there's some sort of undefined behavior in it (just run
it several times and see; some work, but some do show weird stuff
for the cases where with modifiers that make the number wider than
unsigned int).  If you find the undefined behavior, please show
me.  I'll continue debugging, anyway.



This is the UB I'm experiencing:

alx@dell7760:~/tmp$ ./a.out | head
....----....----....----....----
0000000000000000000000000000000000000000000000011111111111110100000000000000000000000001011110;
0000000000000000000000000000000000000000000000011111111111110100000000000000000000000001011110;
00000001011110;
00000001011110;
00000001011110;
0000000000000000000000000000000000000000000000011111111111110100000000000000000000000001011110;
0000000000000000000000000000000000000000000000011111111111110100000000000000000000000001011110;
....----....----....----....----
0b00000001011110;
alx@dell7760:~/tmp$ ./a.out | head
....----....----....----....----
00000001011110;
00000001011110;
00000001011110;
00000001011110;
00000001011110;
00000001011110;
00000001011110;
....----....----....----....----
0b00000001011110;


The first run is wrong, and the second one is correct. The relevant printf(3) lines are:


           printf("....----....----....----....----\n");
           printf("%llb;\n", 0x5Ellu);
           printf("%lB;\n", 0x5Elu);
           printf("%b;\n", 0x5Eu);
           printf("%hB;\n", 0x5Eu);
           printf("%hhb;\n", 0x5Eu);
           printf("%jb;\n", (uintmax_t)0x5E);
           printf("%zb;\n", (size_t)0x5E);
           printf("....----....----....----....----\n");
           printf("%#b;\n", 0x5Eu);


Cheers,

Alex


--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux