[Bug 272758] c16rtomb and c32rtomb wrong return value (at least on aarch64)
Date: Thu, 27 Jul 2023 16:28:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272758
Bug ID: 272758
Summary: c16rtomb and c32rtomb wrong return value (at least on
aarch64)
Product: Base System
Version: 13.1-STABLE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: misc
Assignee: bugs@FreeBSD.org
Reporter: pkk@spth.de
When looking into an SDCC regression test failing for test-host, I found the
following issue:
The mbrtoc16 and mbrtoc32 functions return a wrong value for my test case.
I compiled the following code on a Raspi 4 running FreeBSD13 via "cc test.c"
when executing the resulting binary, the last assertion fails.
#include <limits.h>
#include <assert.h>
#include <uchar.h>
int main(void)
{
static mbstate_t ps;
char16_t c16[3];
char c[MB_LEN_MAX] = "C";
assert(mbrtoc16(c16, c, 1, &ps) == 1);
assert(mbrtoc16(c16 + 1, c + 1, 1, &ps) == 0); // Writes a null wide
character and thus puts ps into the initial conversion state (C2X section
7.30.1.3)
assert(c16[0] == (u"C")[0]);
assert(c16rtomb(c, c16[0], &ps) == 1);
return(0);
}
I do not have any non-aarch64 FreeBSD 13.1 systems to test. But the test does
not fail for Debian GNU/Linux on aarch64 and amd64.
--
You are receiving this mail because:
You are the assignee for the bug.