From nobody Thu Aug 03 11:48:34 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 4RGnDL6ldKz2thhF for ; Thu, 3 Aug 2023 11:48:34 +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 4RGnDL2tJ4z3WCh for ; Thu, 3 Aug 2023 11:48:34 +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=1691063314; 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=UN3mdEXIMDPWCC7qcX0RhYGFNo10Ck32V2leN3grFOc=; b=UdkkTFFufHfRZw9SXlXT/raWn0HVoBkOK9BLKPyY7XdzTj9MOK98qdn4P+nD0v0uvGumk3 BvvevyA0pqLAvxPIB6/WIa4ei02fYVhZGC2ilASDAWyc2iIgQnuj/v7aeR3w5wzlUzTqbL wBlTdJw4xnWAY35LWWriwlZtPqt2dZkD/TjBvMg3vsUaWCzic+ZR4KA7u117qOSLKEt7wA gKAx+oinh2xuF51g+vw2NZFMW5bQSp9KvpZV/Ozs+cpIVvhIJVRTNSjfgHZfKx//xrStSY w4PQDz3YBBtBSDvmQTKuho2y4lRFD9nvQYpb2ERp+0hXch1I6as2ZOOXuuA37Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691063314; a=rsa-sha256; cv=none; b=N3CWxH4PO1/P5WEuANJfkZ6vkxPCWmS8WLt9/LFLlhMgvOAdJMZufbr8vAsWTXqWNLb560 MsBw4tq7vvhO75cYHgyapXuJ+w0BFK0WJ9eM1BCd1c+fnImUuW6VeGj79jPuplBS7jNius IItDPeGhcGHlTtA5p0IdR3thp8h0VqgUD3ICtpnJeVqGC875Q0lgGRKjycfDvz+o8DQzEw WzvJm023JbbE97CmIhZDhYhDMzbKUictkMsASebpti3Vqoha8BfIVFqCcTss29okMjlq4Z WXAP5RSAnrHoiodl76u7oRWrh/0Le9ooSTjJRdIE2P3S05gqIhrIct6MojkGxQ== 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 4RGnDL1Jlfz4v3 for ; Thu, 3 Aug 2023 11:48:34 +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 373BmY7a091666 for ; Thu, 3 Aug 2023 11:48:34 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 373BmYqF091665 for standards@FreeBSD.org; Thu, 3 Aug 2023 11:48:34 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 272914] wcscmp is not ISO C compliant Date: Thu, 03 Aug 2023 11:48:34 +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=3D272914 Bug ID: 272914 Summary: wcscmp 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.1 together with =C2=A7 7.31.4.4.(1) and =C2=A7 7.3= 1.1.(6) specifies that wcscmp must compare the string elements as wchar_t values, and that all 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 wcscmp 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 wcscmp (a, b); 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.=