Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2023 16:28:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 272758] c16rtomb and c32rtomb wrong return value (at least on aarch64)
Message-ID:  <bug-272758-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272758

            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] =3D "C";
  assert(mbrtoc16(c16, c, 1, &ps) =3D=3D 1);
  assert(mbrtoc16(c16 + 1, c + 1, 1, &ps) =3D=3D 0); // Writes a null wide
character and thus puts ps into the initial conversion state (C2X section
7.30.1.3)
  assert(c16[0] =3D=3D (u"C")[0]);
  assert(c16rtomb(c, c16[0], &ps) =3D=3D 1);
  return(0);
}

I do not have any non-aarch64 FreeBSD 13.1 systems to test. But the test do=
es
not fail for Debian GNU/Linux on aarch64 and amd64.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272758-227>