From nobody Tue Jul 25 17:45:43 2023 X-Original-To: bugs@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 4R9PZc24QZz4pYbx for ; Tue, 25 Jul 2023 17:45:44 +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 4R9PZc0HKqz4dMy for ; Tue, 25 Jul 2023 17:45:44 +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=1690307144; 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=c+hFcnx6gIYBghZqFarXFPh9sSluGdiIR+WXvEckQd8=; b=mxtym7w0P2QMZktVapQ06FOpv/BVwPiU/zfOEQMnZ9qpwHBat0SDAEWHx5LADS8dZYfRwC 3yeX/FMSNrQOvVJMVwirAfv7N16gjvPetv95glQPIL/FFxCFcPTB4JmWuw9rKbaLSG6m5L RsPYCbosHG2X4xoj8UI5OCnEPiGY9toqanCWQnS9kb16z6l9Mk8frEKnP7WAd70G4Idr6u 8fdbLLL3xrBSX3TLOSHex41UK7iIjA/9xeOiq0ikxzCTCs4F7dsPPK2m6zeMuUB38cmPZr ujBGBoqe1gi663MC7eHTx99zJGZOEegu+kQZqar5DcQgK6jv4bQHOjeEBV0Aww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690307144; a=rsa-sha256; cv=none; b=jhJ0BtRP+R/LTV4ZdhAAtx6sja4zLEvlPuyLBTCO+OY/WNXxvf0sKCAQaslzpfVMF+0QBA /6Ih30Qsz8NViKprBi1p3oL9k68vjN2e0ND2gzM18lm8Qg0SJhSqt3SQJmZ7AYTa28gpa+ WbM3X5bn3Bru1968KbIVIs7IiyTYjcusQQghJdHwAvaqxVcg62aZ1NyNMyDfFEaJSMbg1l 8I0IXIXj/sPxlzp9k2mvXVcKo2mJkGNs+RHIWWwRZae2fYwQ0kZtielIdOZtBHPDW2+RV4 728f48agFqjMpjVhgdk5PGNK6yCe6t0kQctcQFEh0PEiBmyvqvnAnXObKiUXyQ== 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 4R9PZb65Btz18GY for ; Tue, 25 Jul 2023 17:45:43 +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 36PHjh03017259 for ; Tue, 25 Jul 2023 17:45:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 36PHjhI4017258 for bugs@FreeBSD.org; Tue, 25 Jul 2023 17:45:43 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: bugs@FreeBSD.org Subject: [Bug 272723] header breaks restricted pointers in C++ Date: Tue, 25 Jul 2023 17:45:43 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: sebastian.huber@embedded-brains.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@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: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272723 Bug ID: 272723 Summary: header breaks restricted pointers in C++ Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: sebastian.huber@embedded-brains.de Newlib shares large parts of with FreeBSD and received this b= ug report: https://sourceware.org/pipermail/newlib/2023/020400.html As an extension, GCC and clang offer C99-style restricted pointers in C++ m= ode: https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html We notice that this extension is broken when including newlib headers: restricted pointers are treated as ordinary pointers. We traced this to the following section of newlib/libc/include/sys/cdefs.h: /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict'= as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. */ #if !(__GNUC__ =3D=3D 2 && __GNUC_MINOR__ =3D=3D 95) #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 #define __restrict #else #define __restrict restrict #endif #endif While the GCC __restrict extension was indeed introduced in GCC 2.95, it is= not limited to this version; the extension is also not limited to C90: https://gcc.gnu.org/gcc-2.95/c++features.html This is a suggestion how the logic in the header could be rewritten: /* * We use `__restrict' as a way to define the `restrict' type qualifier * without disturbing older software that is unaware of C99 keywords. * GCC also provides `__restrict' as an extension to support C99-style * restricted pointers in other language modes. */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >=3D 199901 #define __restrict restrict #elif !__GNUC_PREREQ__(2, 95) #define __restrict #endif --=20 You are receiving this mail because: You are the assignee for the bug.=