public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end: Recursively check is_trivially_copyable_or_pair in vec.h
@ 2023-10-02 12:38 Tamar Christina
  2023-10-02 13:21 ` Jakub Jelinek
  0 siblings, 1 reply; 11+ messages in thread
From: Tamar Christina @ 2023-10-02 12:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, jakub, jwakely

[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]

Hi All,

I recently committed a patch that uses a nested std::pair in the second argument.
It temporarily adds a second ranking variable for sorting and then later drops it.

This hits the newly added assert in vec.h.  This assert made some relaxation for
std::pair but doesn't allow this case through.  The patch allows a recursive
std::pair in the second argument which fixes bootstrap.

It should also still maintain the invariant that was being tested here since
the nested arguments should still be trivially copyable.

Bootstrapped on aarch64-none-linux-gnu, x86_64-linux-gnu, and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	vec.h (struct is_trivially_copyable_or_pair): Check recursively in
	second arg.

--- inline copy of patch -- 
diff --git a/gcc/vec.h b/gcc/vec.h
index d509639292b..dcc18c99bfb 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1199,7 +1199,7 @@ namespace vec_detail
   template<typename T, typename U>
   struct is_trivially_copyable_or_pair<std::pair<T, U> >
   : std::integral_constant<bool, std::is_trivially_copyable<T>::value
-    && std::is_trivially_copyable<U>::value> { };
+    && is_trivially_copyable_or_pair<U>::value> { };
 }
 #endif




-- 

[-- Attachment #2: rb17792.patch --]
[-- Type: text/plain, Size: 432 bytes --]

diff --git a/gcc/vec.h b/gcc/vec.h
index d509639292b..dcc18c99bfb 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1199,7 +1199,7 @@ namespace vec_detail
   template<typename T, typename U>
   struct is_trivially_copyable_or_pair<std::pair<T, U> >
   : std::integral_constant<bool, std::is_trivially_copyable<T>::value
-    && std::is_trivially_copyable<U>::value> { };
+    && is_trivially_copyable_or_pair<U>::value> { };
 }
 #endif




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-06  6:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 12:38 [PATCH]middle-end: Recursively check is_trivially_copyable_or_pair in vec.h Tamar Christina
2023-10-02 13:21 ` Jakub Jelinek
2023-10-02 13:28   ` Tamar Christina
2023-10-03 10:27   ` Tamar Christina
2023-10-03 11:01     ` Jakub Jelinek
2023-10-03 11:41       ` Tamar Christina
2023-10-03 11:52         ` Jakub Jelinek
2023-10-05 14:01           ` Tamar Christina
2023-10-05 14:14             ` Jakub Jelinek
2023-10-06  2:23               ` Tamar Christina
2023-10-06  6:38                 ` Jakub Jelinek

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