jcheca / rpms / clang

Forked from rpms/clang 2 years ago
Clone
7dba278
From 0f97b7209eed4a428171af6044fe7e0aaf81ee2a Mon Sep 17 00:00:00 2001
7dba278
From: Nikita Popov <npopov@redhat.com>
7dba278
Date: Thu, 3 Feb 2022 10:34:44 +0100
7dba278
Subject: [PATCH] Work around gcc miscompile
7dba278
7dba278
This works around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104334,
7dba278
which miscompiles clang on s390x and ppc64le. The issue is already
7dba278
fixed on the gcc side, but including this as a temporary workaround
7dba278
to get a working build.
7dba278
---
7dba278
 clang/lib/Sema/DeclSpec.cpp | 5 +++--
7dba278
 1 file changed, 3 insertions(+), 2 deletions(-)
7dba278
7dba278
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
7dba278
index d4dc790c008a..77a1e6c32c6f 100644
7dba278
--- a/clang/lib/Sema/DeclSpec.cpp
7dba278
+++ b/clang/lib/Sema/DeclSpec.cpp
7dba278
@@ -1203,8 +1203,9 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
7dba278
     } else if (TypeSpecType == TST_double) {
7dba278
       // vector long double and vector long long double are never allowed.
7dba278
       // vector double is OK for Power7 and later, and ZVector.
7dba278
-      if (getTypeSpecWidth() == TypeSpecifierWidth::Long ||
7dba278
-          getTypeSpecWidth() == TypeSpecifierWidth::LongLong)
7dba278
+      TypeSpecifierWidth TypeSpecWidth = getTypeSpecWidth();
7dba278
+      if (TypeSpecWidth == TypeSpecifierWidth::Long ||
7dba278
+          TypeSpecWidth == TypeSpecifierWidth::LongLong)
7dba278
         S.Diag(TSWRange.getBegin(),
7dba278
                diag::err_invalid_vector_long_double_decl_spec);
7dba278
       else if (!S.Context.getTargetInfo().hasFeature("vsx") &&
7dba278
--
7dba278
2.34.1
7dba278
7dba278