From: Alex Colomar <alx.manpages@gmail.com>
To: linux-man@vger.kernel.org, libc-alpha@sourceware.org
Cc: Walter Harms <wharms@bfs.de>
Subject: Re: [PATCH] register_printf_speficier.3, register_printf_modifier.3, register_printf_type.3: Add new manual page and links
Date: Mon, 19 Sep 2022 00:38:52 +0200 [thread overview]
Message-ID: <d84d7fbf-51d4-4d0d-96ea-9ca10d9ee3a7@gmail.com> (raw)
In-Reply-To: <23ae1f95-d2aa-87f7-664e-ba3ffab16c43@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2252 bytes --]
On 9/19/22 00:36, Alex Colomar wrote:
> 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;
>
Oh, and I have extra zeros, but that's a bug I introduced today. Before
that, the other one is still there. :/
>
> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-09-18 22:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 22:16 Alex Colomar
2022-09-18 22:36 ` Alex Colomar
2022-09-18 22:38 ` Alex Colomar [this message]
2022-09-18 23:09 ` [RFC v2] " Alex Colomar
2022-09-19 8:55 ` Alex Colomar
2022-09-18 23:18 ` [PATCH] " G. Branden Robinson
2022-09-18 23:25 ` Alex Colomar
2022-09-19 16:54 ` [RFC v3] printf.3head: Document functions for customizing printf(3)-like functions Alex Colomar
2022-09-19 16:54 ` [RFC v3 2/4] register_printf_specifier.3, register_printf_modifier.3, register_printf_type.3: Add links to printf.h(3head) Alex Colomar
2022-09-19 16:54 ` [RFC v3 3/4] printf_arginfo_size_function.3type, printf_function.3type, printf_info.3type, printf_va_arg_function.3type: " Alex Colomar
2022-09-19 16:54 ` [RFC v3 4/4] PA_CHAR.3const, PA_DOUBLE.3const, PA_FLAG_LONG.3const, PA_FLAG_LONG_DOUBLE.3const, PA_FLAG_LONG_LONG.3const, PA_FLAG_PTR.3const, PA_FLAG_SHORT.3const, PA_FLOAT.3const, PA_INT.3const, PA_LAST.3const, PA_POINTER.3const, PA_STRING.3const, PA_WCHAR.3const, PA_WSTRING.3const: " Alex Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d84d7fbf-51d4-4d0d-96ea-9ca10d9ee3a7@gmail.com \
--to=alx.manpages@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=wharms@bfs.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).