public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "david.spickett at linaro dot org" <gcc-bugzilla@gcc.gnu.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	[thread overview]
Message-ID: <bug-108642-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642

            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 <stdint.h>
#include <arm_acle.h>

void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); }
```

When compiled with g++ gives the error:
```
<source>: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:
```
<source>: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 errors
or warnings.

This __arm_wsr function should be present after including arm_acle.h according
to https://github.com/ARM-software/acle/releases/tag/r2022Q4 (acle-2022Q4.pdf
). 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.

             reply	other threads:[~2023-02-02 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 16:57 david.spickett at linaro dot org [this message]
2023-02-02 17:04 ` [Bug target/108642] ACLE function __arm_wsr missing " pinskia at gcc dot gnu.org
2023-02-02 17:06 ` pinskia at gcc dot gnu.org
2023-02-02 17:07 ` pinskia at gcc dot gnu.org
2023-02-02 17:09 ` david.spickett at linaro dot org
2023-02-02 17:10 ` pinskia at gcc dot gnu.org
2023-02-03 16:25 ` david.spickett at linaro dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108642-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).