From 8fe436b4a2d47c404163b0330b2ed21db9bfdc30 Mon Sep 17 00:00:00 2001 From: James Moschou Date: Tue, 7 Jul 2026 16:27:22 +0200 Subject: [PATCH] Fix compare_existential_values not comparing lhs with rhs --- Sources/ComputeCxx/Comparison/LayoutDescriptor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/ComputeCxx/Comparison/LayoutDescriptor.cpp b/Sources/ComputeCxx/Comparison/LayoutDescriptor.cpp index aaef2bb..89e355a 100644 --- a/Sources/ComputeCxx/Comparison/LayoutDescriptor.cpp +++ b/Sources/ComputeCxx/Comparison/LayoutDescriptor.cpp @@ -583,7 +583,7 @@ bool compare_existential_values(const swift::existential_type_metadata &type, co if (auto rhs_dynamic_type = type.dynamic_type((void *)rhs)) { if (lhs_dynamic_type == rhs_dynamic_type) { unsigned char *lhs_value = (unsigned char *)type.project_value((void *)lhs); - unsigned char *rhs_value = (unsigned char *)type.project_value((void *)lhs); + unsigned char *rhs_value = (unsigned char *)type.project_value((void *)rhs); if (lhs_value == rhs_value) { return true; } @@ -592,10 +592,10 @@ bool compare_existential_values(const swift::existential_type_metadata &type, co options = options & ~IAGComparisonOptionsCopyOnWrite; } - ValueLayout wrapped_layout = fetch(reinterpret_cast(type), options, 0); + ValueLayout wrapped_layout = fetch(*lhs_dynamic_type, options, 0); ValueLayout layout = wrapped_layout == ValueLayoutTrivial ? nullptr : wrapped_layout; - return compare(layout, lhs_value, rhs_value, type.vw_size(), options); + return compare(layout, lhs_value, rhs_value, lhs_dynamic_type->vw_size(), options); } } }