public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-5831] builtins: Avoid ICE with __builtin_clear_padding on POINTERS_EXTEND_UNSIGNED targets [PR98147] Date: Mon, 7 Dec 2020 18:21:06 +0000 (GMT) [thread overview] Message-ID: <20201207182106.1018838618B2@sourceware.org> (raw) https://gcc.gnu.org/g:b737b70fad398728f6006e8397d1bb31ccea4ce7 commit r11-5831-gb737b70fad398728f6006e8397d1bb31ccea4ce7 Author: Jakub Jelinek <jakub@redhat.com> Date: Mon Dec 7 19:20:25 2020 +0100 builtins: Avoid ICE with __builtin_clear_padding on POINTERS_EXTEND_UNSIGNED targets [PR98147] The function that calls targetm.emit_call_builtin___clear_cache asserts that each of the begin and end operands has either ptr_mode or Pmode. On most targets that is the same mode, but e.g. on aarch64 -mabi=ilp32 or a few others it is different. When a target has a clear cache non-library handler, it will use create_address_operand which will do the conversion to the right mode automatically, but when emitting a library call, we just say the operands are ptr_mode even when they can be Pmode too; in that case we need to convert explicitly. 2020-12-07 Jakub Jelinek <jakub@redhat.com> PR target/98147 * builtins.c (default_emit_call_builtin___clear_cache): Call convert_memory_address to ptr_mode on both begin and end. * gcc.dg/pr98147.c: New test. Diff: --- gcc/builtins.c | 4 ++-- gcc/testsuite/gcc.dg/pr98147.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/builtins.c b/gcc/builtins.c index bd12659712f..faa5030853b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7790,8 +7790,8 @@ default_emit_call_builtin___clear_cache (rtx begin, rtx end) emit_library_call (callee, LCT_NORMAL, VOIDmode, - begin, ptr_mode, - end, ptr_mode); + convert_memory_address (ptr_mode, begin), ptr_mode, + convert_memory_address (ptr_mode, end), ptr_mode); } /* Emit a call to __builtin___clear_cache, unless the target specifies diff --git a/gcc/testsuite/gcc.dg/pr98147.c b/gcc/testsuite/gcc.dg/pr98147.c new file mode 100644 index 00000000000..3edc7985f10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr98147.c @@ -0,0 +1,10 @@ +/* PR target/98147 */ + +char buffer[32] = "foo bar"; + +int +main () +{ + __builtin___clear_cache (buffer, buffer + 32); + return 0; +}
reply other threads:[~2020-12-07 18:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201207182106.1018838618B2@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).