delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/05/23/16:17:01

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 44NKH0fg2964692
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=bQC3eKaO
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20D71384AB43
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1716495419;
bh=u6Bfb42HEyU7GxTovn9SsL0oBedVLbM2xpB7zuO0Fm4=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=bQC3eKaOMlhXFrGcF6QDdrw0ZXbD2RgqniNZQpUEMFqHSqZVW5zIXk4Sbxm7SJfkc
kVOzFlgK2NL88aFlYNrMlLkfbt8aU6icJy1gDSg/H9grUuu6CtxA9t2OSQHv8GO23p
oWreuTFiOHlSeKCxIo0Veb+Cfgny5+C4MAlGU0/Q=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFF8C3858CD1
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BFF8C3858CD1
ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1716495399; cv=pass;
b=CfUxvFjVFitVmRPWwYEIcAdUDKL3pmnEZcWRHxyM7xA4J6Yhl3MqXkLJ7oDaEuaqEKWGWg+hRKAO+YPNIGGASHAw/jWtQRne4WVSwc8aZtIism4qWac26hvKvyzJBIBNvna9mh+vY9sDEPixUTygXW7fdTbNZY/cFPWJvVIULuA=
ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key;
t=1716495399; c=relaxed/simple;
bh=9m+TOnlfePKi2VPy0wQdRsIhEyHKtdfNNN+nrDsCFv8=;
h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID:
MIME-Version;
b=cSwq2mrnhhzOCe+x0YIzgzm+u8a5CDWKCSan+igUZ9ma+ZW4locLw5j3qFmjsXXcfGCEysEIC2xz9huU1mE0Zugilt80rnVBqR8g/8Yr2Div/4VZUTK6sP8M/tEY8jd5Nc/0JDAoF6IZR+dIlHSBxUfF0kUE3UZNeOUt+RJBQgA=
ARC-Authentication-Results: i=2; server2.sourceware.org
ARC-Seal: i=1; a=rsa-sha256; t=1716495396; cv=none;
d=strato.com; s=strato-dkim-0002;
b=Pu77BIGI0F4xuLH6Sm2POOZkiJmvxytCddohBFuk6Q1Yh3E3XCMdxI9o9T9B76meUR
xmoZis01VOak6d/5Bor9TJbi5m/a2+b5EV8zI/OaL7ujpsXMVkubUw24IvQBoUFez0mN
M9d8IwYykrwqXT3Ff2Y1yrE9oEN2apWxmLw323ULeKCeUIZbi1yc36UZ27gxgsZFJD/K
vrAEZmN3E8TERjN0eOmUsu0a8dDHr2Sinom9+exTjxy4nm7dRg93nVpp5qnjN5sbdeXr
98zH4Vsmkrb+2VYBl6sOLD0++Iueom978gevcwqzDo3Y2rMOFJ4PBs1VViFlK/mYS4ti
p8mA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1716495396;
s=strato-dkim-0002; d=strato.com;
h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender;
bh=oEoszkg/sJVceG3RoNvNnYMPSo2SEg4RN/ogFYzS/jc=;
b=YTw0QvXtp/jnLyqinkDKMPIEKCDkZGQUEICM6ukusDmd2V7iRB+Mx1Ow8rnBaPDAwn
Sw5psEgwjMRD1uY9NF6Zf1MI6pBoaPuYvatPoHxuoeHmEDhf76DLnPicpEIAmKzxHu9w
NRNvVbLT/js7rsZDvrfK12T+fzQEaiU2/J2fAOSA01v1kxr6idDfqNRSX8ec2l/skPqK
yD0i67Eo5x6zTwwxTYpNnexffvN3mx7X97SvPW0jhKwQM84MCoa3axfs3cKJR7dhC+/Z
e7cgOPurMvTjF8qbOXs3uEhmJv+ppEh4RUGodbpIJkxVrsKOJGPaX1LC8dh4vou0fAm9
MCXA==
ARC-Authentication-Results: i=1; strato.com;
arc=none;
dkim=none
X-RZG-CLASS-ID: mo00
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPC26fyUHTfX3hM/lJqGSPH4qu4hA=="
To: cygwin AT cygwin DOT com
Subject: an mbrtoc32 bug
Date: Thu, 23 May 2024 22:16:35 +0200
Message-ID: <6004047.n2Wp99KBFH@nimes>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,
RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Bruno Haible via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Bruno Haible <bruno AT clisp DOT org>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

This is a multi-part message in MIME format.

--nextPart1725703.3zPMhFXRWZ
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="iso-8859-1"

In Cygwin 3.5.3, the attached program has an assertion failure in line 24:
bytes is not (size_t)-2.

How to reproduce:
$ gcc -Wall foo.c
$ ./a

I think this is a bug, because
  - ISO C 23 =A7 7.30.1.5 talks about "completing" a character, not
    "representing" an (entire) character.
  - The test passes on glibc, musl libc, FreeBSD 14.0, Solaris 11.4.

Bruno


--nextPart1725703.3zPMhFXRWZ
Content-Disposition: attachment; filename="foo.c"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-csrc; charset="UTF-8"; name="foo.c"

#include <assert.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uchar.h>
#include <wchar.h>

int main ()
{
  assert (setlocale (LC_ALL, "en_US.UTF-8") != NULL);
  mbstate_t state;
  memset (&state, 0, sizeof (state));

  char32_t uc = 0xDEADBEEF;
  size_t bytes;

  /* \360\237\220\203 = U+0001F403 */
  bytes = mbrtoc32 (&uc, "\360", 1, &state);
  assert (bytes == (size_t)-2);
  bytes = mbrtoc32 (&uc, "\237", 1, &state);
  assert (bytes == (size_t)-2);
  bytes = mbrtoc32 (&uc, "\220", 1, &state);
  assert (bytes == (size_t)-2);
  bytes = mbrtoc32 (&uc, "\203", 1, &state);
  assert (bytes == 1);
  assert (uc == 0x0001F403);
}

/* Works in: glibc, musl libc, FreeBSD 14.0, Solaris 11.4
   Fails in: Cygwin 3.5.3
 */

--nextPart1725703.3zPMhFXRWZ
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


-- 
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

--nextPart1725703.3zPMhFXRWZ--



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019