public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] aarch64: Avoid registering duplicate C++ overloads [PR112989]
@ 2024-01-23 11:12 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2024-01-23 11:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: iain

In the original fix for this PR, I'd made sure that
including <arm_sme.h> didn't reach the final return in
simulate_builtin_function_decl (which would indicate duplicate
function definitions).  But it seems I forgot to do the same
thing for C++, which defines all of its overloads directly.

This patch fixes a case where we still recorded duplicate
functions for C++.  Thanks to Iain for reporting the resulting
GC ICE and for help with reproducing it.

Tested on aarch64-linux-gnu & pushed.

Richard


gcc/
	PR target/112989
	* config/aarch64/aarch64-sve-builtins-shapes.cc (build_one): Skip
	MODE_single variants of functions that don't take tuple arguments.
---
 gcc/config/aarch64/aarch64-sve-builtins-shapes.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
index 2692b086ac5..f190770250f 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc
@@ -338,6 +338,14 @@ build_one (function_builder &b, const char *signature,
 	   unsigned int ti, unsigned int gi, unsigned int pi,
 	   bool force_direct_overloads)
 {
+  /* For simplicity, function definitions are allowed to use the group
+     suffix lists vg2 and vg4 for shapes that have _single forms,
+     even though the _single form applies only to vgNx2 and vgNx4,
+     not to vgNx1.  */
+  if (mode_suffix_id == MODE_single
+      && group_suffixes[group.groups[gi]].vectors_per_tuple == 1)
+    return;
+
   /* Byte forms of svdupq take 16 arguments.  */
   auto_vec<tree, 16> argument_types;
   function_instance instance (group.base_name, *group.base, *group.shape,
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-23 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 11:12 [pushed] aarch64: Avoid registering duplicate C++ overloads [PR112989] Richard Sandiford

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).