From 75145e4759c8e12bf8994889ee69c24bacf1c4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= Date: Thu, 25 Jan 2024 12:55:42 +0100 Subject: [PATCH] dev-cpp/highway: revbump for UB case fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/922793 Signed-off-by: Daniel Novomeský Closes: https://github.com/gentoo/gentoo/pull/35005 Signed-off-by: Joonas Niilola --- ...0.7-Fix_UB_case_with_signed_overflow.patch | 29 +++++++++++++ dev-cpp/highway/highway-1.0.7-r1.ebuild | 41 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 dev-cpp/highway/files/highway-1.0.7-Fix_UB_case_with_signed_overflow.patch create mode 100644 dev-cpp/highway/highway-1.0.7-r1.ebuild diff --git a/dev-cpp/highway/files/highway-1.0.7-Fix_UB_case_with_signed_overflow.patch b/dev-cpp/highway/files/highway-1.0.7-Fix_UB_case_with_signed_overflow.patch new file mode 100644 index 0000000000000..814d584e8b3af --- /dev/null +++ b/dev-cpp/highway/files/highway-1.0.7-Fix_UB_case_with_signed_overflow.patch @@ -0,0 +1,29 @@ +https://github.com/google/highway/issues/1549 +https://github.com/google/highway/commit/45eea15b5488f3e7a15c2c94ac77bd9e99703203 + +From 45eea15b5488f3e7a15c2c94ac77bd9e99703203 Mon Sep 17 00:00:00 2001 +From: Mathieu Malaterre +Date: Thu, 5 Oct 2023 08:00:38 +0200 +Subject: [PATCH] Fix UB case with signed overflow, prefer unsigned + +Fixes #1549 + +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110643 +Suggested-by: Andrew Pinski +--- + hwy/ops/arm_neon-inl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hwy/ops/arm_neon-inl.h b/hwy/ops/arm_neon-inl.h +index 7ac7a10c62..97de46be2e 100644 +--- a/hwy/ops/arm_neon-inl.h ++++ b/hwy/ops/arm_neon-inl.h +@@ -4592,7 +4592,7 @@ HWY_API Mask128 IsNaN(const Vec128 v) { + template + HWY_API Mask128 IsInf(const Vec128 v) { + const DFromV d; +- const RebindToSigned di; ++ const RebindToUnsigned di; + const VFromD vi = BitCast(di, v); + // 'Shift left' to clear the sign bit, check for exponent=max and mantissa=0. + return RebindMask(d, Eq(Add(vi, vi), Set(di, hwy::MaxExponentTimes2()))); diff --git a/dev-cpp/highway/highway-1.0.7-r1.ebuild b/dev-cpp/highway/highway-1.0.7-r1.ebuild new file mode 100644 index 0000000000000..98f940b6570c6 --- /dev/null +++ b/dev-cpp/highway/highway-1.0.7-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 2021-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake-multilib + +DESCRIPTION="Performance-portable, length-agnostic SIMD with runtime dispatch" +HOMEPAGE="https://github.com/google/highway" + +if [[ "${PV}" == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/google/highway.git" +else + SRC_URI="https://github.com/google/highway/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="cpu_flags_arm_neon test" + +DEPEND="test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" + +RESTRICT="!test? ( test )" + +PATCHES=( + "${FILESDIR}/${PN}-1.0.7-Fix_UB_case_with_signed_overflow.patch" +) + +multilib_src_configure() { + local mycmakeargs=( + -DHWY_CMAKE_ARM7=$(usex cpu_flags_arm_neon) + -DBUILD_TESTING=$(usex test) + -DHWY_WARNINGS_ARE_ERRORS=OFF + ) + + use test && mycmakeargs+=( "-DHWY_SYSTEM_GTEST=ON" ) + + cmake_src_configure +}