From nobody Thu Aug 03 11:53:16 2023 X-Original-To: standards@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RGnKm4RHHz2tjL2 for ; Thu, 3 Aug 2023 11:53:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RGnKm1DBCz3X2Y for ; Thu, 3 Aug 2023 11:53:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691063596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UTTC2rn+CKQiYqKDulum+LR1OUCq2/SQyx5XZKulbwA=; b=GFyNRpdEu5BrzVQn8D8j/i0MIfJy/BdNOORvkYLo5G8FOd9P4kUkBAmbZMdd7IYnn+4avK W2jXpVM9LUoAgOiwJXJzQVMFDj2H3Qjp/IYogWHj3ig0M8eWPHb5hJmzvL3HA/EGHA0TbO 1ouIcmKBcAdpWtO0oaOX7pw7DtxmdAbLoBeCBo4ddWOdVR6NenbrzC7c/3R50hTmswRZBV pgk1TXoVEDJdl49eMzLbRXgWAy9PCzQBu4cLTicDUrH9E6VH7VlTP8aYTkOa7EDcAh8NGK 5neWqhTeiU1RlMgp7hIPz92sdDCzVP9QBbR46GkvqQbgPxi5mm1azrXlXXyaQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691063596; a=rsa-sha256; cv=none; b=mvht6gYc/VFJBHeniCKfn/lToes278IkoN/Tz5atWGd1EdRlNXc3HRRzii8OQ4GF9arVOC x/SP6F2Jo2oA3ryB12+y4W9Lyr5OW3ounPY1fQdqz1D5QaNsHOa+SY57jpyc3XSEGtWp5A U/Vh8GSzYCxagocpia7r1lUGrZbxWwMuAZY2xASd8Lngv/UgHmBkwnlaKBvEoof/DI3P5O 00Cf1iLe+fItLt2rhnQZZ9P+PB3yzWPvjGYGq5cGFRgTu0z0OHNOgdvDphBOGZIa/I3ntU 5/VGoofioKFQG07rNgz5MMaUJoNQHLjGM4G5N+lR4nGx0B89Y6+JrqJvlZvoNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RGnKm01PGz4dH for ; Thu, 3 Aug 2023 11:53:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 373BrFbi005556 for ; Thu, 3 Aug 2023 11:53:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 373BrFXU005555 for standards@FreeBSD.org; Thu, 3 Aug 2023 11:53:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: standards@FreeBSD.org Subject: [Bug 272915] wcsncmp is not ISO C compliant Date: Thu, 03 Aug 2023 11:53:16 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: standards X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: bruno@clisp.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: standards@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Standards compliance List-Archive: https://lists.freebsd.org/archives/freebsd-standards List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272915 Bug ID: 272915 Summary: wcsncmp is not ISO C compliant Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: standards Assignee: standards@FreeBSD.org Reporter: bruno@clisp.org ISO C 23 =C2=A7 7.31.4.4.3 together with =C2=A7 7.31.4.4.(1) and =C2=A7 7.3= 1.1.(6) specifies that wcsncmp must compare the string elements as wchar_t values, and that a= ll wchar_t values can legitimately occur. On FreeBSD/x86_64, wchar_t is signed, i.e. equivalent to 'int'. In the test case below, cmp must therefore come out positive, since a[0] > 0 > b[0]. But wcsncmp in FreeBSD compares the wchar_t values as if they were unsigned. How to reproduce: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D foo.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include int main () { /* This test fails on glibc < 2.15, musl libc 1.2.3, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, Solaris 11.4. */ wchar_t a[2] =3D { (wchar_t) 0x76547654, 0 }; wchar_t b[2] =3D { (wchar_t) 0x9abc9abc, 0 }; int cmp =3D wcsncmp (a, b, 1); return (!((wchar_t)-1 < 0 ? cmp > 0 : cmp < 0)); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ cc foo.c $ ./a.out $ echo $? 1 --=20 You are receiving this mail because: You are the assignee for the bug.=