Re: wcwidth broken with gcc 16

Thomas Wolff via Cygwin <[email protected]> Sun, 3 May 2026 14:00:44 +0200
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
Am 03.05.2026 um 12:58 schrieb Dimitry Andric:
> On 3 May 2026, at 12:47, Thomas Wolff via Cygwin <[email protected]> wrote:
>> Am 03.05.2026 um 07:35 schrieb ASSI via Cygwin:
>>> Thomas Wolff via Cygwin writes:
>>>> Observed with gcc 16:
>>>> For a number of character ranges, mainly (but not only) from CJK
>>>> ranges, wcwidth incorrectly reports width 1 instead of 2, 0, or -1.
>>>> Test file attached.
>>> Can you report this upstream, please?
>> I couldn't yet test it with gcc 16 on Linux as there is no Debian package.
>> Did you test it?
> On Ubuntu 26.04, with gcc version 16.0.1 20260322, the results are:
>
> 2 U+8000
> -1 U+A4CF
> 0 U+A66F
> 0 U+A672
> 0 U+A674
> 0 U+A67D
> 0 U+A8E0
> 0 U+A8F1
> 2 U+AC00
> 0 U+D7C6
> 0 U+D7CB
> 0 U+D7FB
> -1 U+D800
> -1 U+DFFF
> 2 U+F900
> -1 U+FAFF
> 0 U+FE00
> -1 U+FE6F
> 2 U+FF01
> 2 U+FF60
> 2 U+FFE0
> 2 U+FFE6
>
> On macOS 15.7.5 with Apple clang 17.0.0 (clang-1700.6.4.2):
>
> 2 U+8000
> -1 U+A4CF
> 0 U+A66F
> 0 U+A672
> 0 U+A674
> 0 U+A67D
> 0 U+A8E0
> 0 U+A8F1
> 2 U+AC00
> 1 U+D7C6
> 1 U+D7CB
> 1 U+D7FB
> -1 U+D800
> -1 U+DFFF
> 2 U+F900
> -1 U+FAFF
> 0 U+FE00
> -1 U+FE6F
> 2 U+FF01
> 2 U+FF60
> 2 U+FFE0
> 2 U+FFE6
>
> On FreeBSD 15.0 with clang 19.1.7:
>
> 2 U+8000
> -1 U+A4CF
> 0 U+A66F
> 0 U+A672
> 0 U+A674
> 0 U+A67D
> 0 U+A8E0
> 0 U+A8F1
> 2 U+AC00
> 1 U+D7C6
> 1 U+D7CB
> 1 U+D7FB
> -1 U+D800
> -1 U+DFFF
> 2 U+F900
> -1 U+FAFF
> 0 U+FE00
> -1 U+FE6F
> 2 U+FF01
> 2 U+FF60
> 2 U+FFE0
> 2 U+FFE6
>
> It looks like BSD-based libc gives 1 for U+D7C6, U+D7CB and U+D7CB, while glibc gives 0.
Thanks. Despite some differences, none of them gives the broken results 
of gcc-16 on cygwin, so I wonder whether it makes sense to report 
upstream at this time.

> -Dimitry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple