From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 38DAB3858C52; Thu, 2 Feb 2023 16:57:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38DAB3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675357061; bh=E4GB15zWP3dvTvdylwMNcxKFi22OXEIUtjp1Kk17AgA=; h=From:To:Subject:Date:From; b=U/loEGW7exJrDqo7ToLQppmIPI9MEasByEISEMVfdd5VQqhOw97HhHM7d6NC0pCnO 3PX/vOKxjsbtz2a4yRAc1GGYf/97pEg8HDVUdSHN2ssdG/SeSuP8whh2FaN27gepfM 5w3aNWV15CjkkczxRVHFs6lRkioY/xuTzlJHtBtw= From: "david.spickett at linaro dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 Date: Thu, 02 Feb 2023 16:57:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.spickett at linaro dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108642 Bug ID: 108642 Summary: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david.spickett at linaro dot org Target Milestone: --- This was found by a user trying to compile llvm's libc (which is largely written in c++) using g++ 8.5.0 for AArch64. I then tried versions up to 12= .2.0 and a recent trunk build. https://godbolt.org/z/qxaYxdTcv, and I've copied the details below. The following source: ``` #include #include void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } ``` When compiled with g++ gives the error: ``` :4:39: error: '__arm_wsr' was not declared in this scope 4 | void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } | ^~~~~~~~~ ``` When compiled as C, there is instead a warning and it does compile: ``` :4:39: warning: implicit declaration of function '__arm_wsr' [-Wimplicit-function-declaration] 4 | void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } | ^~~~~~~~~ ``` The expected result would be that in either mode, we can compile without er= rors or warnings. This __arm_wsr function should be present after including arm_acle.h accord= ing to https://github.com/ARM-software/acle/releases/tag/r2022Q4 (acle-2022Q4.p= df ). See "11.1 Special register intrinsics". I looked in the arm_acle.h gcc/g++ is including and see no reference to it. Which makes me wonder if it's a compiler builtin that somehow isn't present= for C++. Over in clang there is a builtin for it, that is then #defined into the __arm_wsr name in the header.=