From 7dba2783b758751c9855ee935bcd4010c7fdee23 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Feb 03 2022 09:46:54 +0000 Subject: Work around gcc miscompile This works around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104334, which miscompiles clang on s390x and ppc64le. The issue is already fixed on the gcc side and a new fedora build is in progress, but including this as a temporary workaround to get a working build. --- diff --git a/0001-Work-around-gcc-miscompile.patch b/0001-Work-around-gcc-miscompile.patch new file mode 100644 index 0000000..16c1467 --- /dev/null +++ b/0001-Work-around-gcc-miscompile.patch @@ -0,0 +1,33 @@ +From 0f97b7209eed4a428171af6044fe7e0aaf81ee2a Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Thu, 3 Feb 2022 10:34:44 +0100 +Subject: [PATCH] Work around gcc miscompile + +This works around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104334, +which miscompiles clang on s390x and ppc64le. The issue is already +fixed on the gcc side, but including this as a temporary workaround +to get a working build. +--- + clang/lib/Sema/DeclSpec.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp +index d4dc790c008a..77a1e6c32c6f 100644 +--- a/clang/lib/Sema/DeclSpec.cpp ++++ b/clang/lib/Sema/DeclSpec.cpp +@@ -1203,8 +1203,9 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) { + } else if (TypeSpecType == TST_double) { + // vector long double and vector long long double are never allowed. + // vector double is OK for Power7 and later, and ZVector. +- if (getTypeSpecWidth() == TypeSpecifierWidth::Long || +- getTypeSpecWidth() == TypeSpecifierWidth::LongLong) ++ TypeSpecifierWidth TypeSpecWidth = getTypeSpecWidth(); ++ if (TypeSpecWidth == TypeSpecifierWidth::Long || ++ TypeSpecWidth == TypeSpecifierWidth::LongLong) + S.Diag(TSWRange.getBegin(), + diag::err_invalid_vector_long_double_decl_spec); + else if (!S.Context.getTargetInfo().hasFeature("vsx") && +-- +2.34.1 + + diff --git a/clang.spec b/clang.spec index c76a056..0bc1e23 100644 --- a/clang.spec +++ b/clang.spec @@ -95,6 +95,8 @@ Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch Patch5: 0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch +# This patch can be dropped once gcc-12.0.1-0.5.fc36 is in the repo. +Patch6: 0001-Work-around-gcc-miscompile.patch BuildRequires: gcc BuildRequires: gcc-c++