public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "acoplan at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110132] New: aarch64: Bogus -Wbuiltin-declaration-mismatch with ls64 builtins
Date: Mon, 05 Jun 2023 21:32:57 +0000	[thread overview]
Message-ID: <bug-110132-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110132
           Summary: aarch64: Bogus -Wbuiltin-declaration-mismatch with
                    ls64 builtins
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

If one subverts arm_acle.h and tries to create a minimal preprocessed test case
using ls64 builtins:

$ cat ls64.i
#pragma GCC aarch64 "arm_acle.h"
typedef __arm_data512_t data512_t;
void f(void *p, data512_t d) {
  __builtin_aarch64_st64b(p, d);
}
./xgcc -B . -c ls64.i -S -o /dev/null -march=armv8.7-a
ls64.i: In function ‘f’:
ls64.i:4:3: warning: implicit declaration of function ‘__builtin_aarch64_st64b’
[-Wimplicit-function-declaration]
    4 |   __builtin_aarch64_st64b(p, d);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
ls64.i:4:3: warning: incompatible implicit declaration of built-in function
‘__builtin_aarch64_st64b’ [-Wbuiltin-declaration-mismatch]

we get these bogus warnings. The normal flow for e.g. Advanced SIMD builtins
is:
 - Backend calls add_builtin_function.
 - c_builtin_function adds the builtin to the list of visible_builtins.
 - push_file_scope gets called and builtins in visible_builtins are made
visible.

The problem here is that aarch64_init_ls64_builtins is called when processing
the pragma for arm_acle.h, which is *after* push_file_scope gets called, so the
builtins never get made visible by the C FE.

I think it might be easiest to make the ls64 handling more SVE-like and use the
simulate_builtin_function_decl langhook (which doesn't have this deferred
visibility situation), dropping the wrapper functions from arm_acle.h
altogether.

             reply	other threads:[~2023-06-05 21:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 21:32 acoplan at gcc dot gnu.org [this message]
2023-06-05 21:43 ` [Bug target/110132] " acoplan at gcc dot gnu.org
2023-06-06 13:56 ` acoplan at gcc dot gnu.org
2023-06-07 16:46 ` cvs-commit at gcc dot gnu.org
2023-06-07 16:50 ` acoplan at gcc dot gnu.org
2023-06-20 21:22 ` cvs-commit at gcc dot gnu.org
2023-06-22 10:19 ` cvs-commit at gcc dot gnu.org
2023-06-22 10:21 ` acoplan at gcc dot gnu.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-110132-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).