Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2023 19:55:48 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: 15c6bbdcf036 - 2023Q3 - devel/llvm16: backport upstream powerpc FP fix
Message-ID:  <202307201955.36KJtmtJ053067@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2023Q3 has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=15c6bbdcf036f237ad6856f6e320788f92eb8892

commit 15c6bbdcf036f237ad6856f6e320788f92eb8892
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-07-14 19:07:06 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-07-20 18:34:51 +0000

    devel/llvm16: backport upstream powerpc FP fix
    
    The upstream commit fde5924dcc69 has been merged to llvm in the FreeBSD
    main branch so merge it here as well.
    
    Issue: https://github.com/llvm/llvm-project/issues/63542
    (cherry picked from commit 2a9d785d67c6d66268d46f4d3ff0f255dc01e9ea)
---
 devel/llvm16/Makefile                          |  2 +-
 devel/llvm16/files/patch-backport-fde5924dcc69 | 45 ++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/devel/llvm16/Makefile b/devel/llvm16/Makefile
index 7a70876d13e7..c261324da428 100644
--- a/devel/llvm16/Makefile
+++ b/devel/llvm16/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 DISTVERSION=	16.0.6
-PORTREVISION=	2
+PORTREVISION=	4
 CATEGORIES=	devel lang
 MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
 		https://${PRE_}releases.llvm.org/${LLVM_RELEASE}${RCDIR}/
diff --git a/devel/llvm16/files/patch-backport-fde5924dcc69 b/devel/llvm16/files/patch-backport-fde5924dcc69
new file mode 100644
index 000000000000..a4fad341afdc
--- /dev/null
+++ b/devel/llvm16/files/patch-backport-fde5924dcc69
@@ -0,0 +1,45 @@
+commit fde5924dcc69fe814085482df259b8cfee236f2c
+Author: Serge Pavlov <sepavloff@gmail.com>
+Date:   Thu Jul 13 11:49:00 2023 +0700
+
+    [clang] Reset FP options before template instantiation
+    
+    AST nodes that may depend on FP options keep them as a difference
+    relative to the options outside the AST node. At the moment of
+    instantiation the FP options may be different from the default values,
+    defined by command-line option. In such case FP attributes would have
+    unexpected values. For example, the code:
+    
+        template <class C> void func_01(int last, C) {
+          func_01(last, int());
+        }
+        void func_02() { func_01(0, 1); }
+        #pragma STDC FENV_ACCESS ON
+    
+    caused compiler crash, because template instantiation takes place at the
+    end of translation unit, where pragma STDC FENV_ACCESS is in effect. As
+    a result, code in the template instantiation would use constrained
+    intrinsics while the function does not have StrictFP attribute.
+    
+    To solve this problem, FP attributes in Sema must be set to default
+    values, defined by command line options.
+    
+    This change resolves https://github.com/llvm/llvm-project/issues/63542.
+    
+    Differential Revision: https://reviews.llvm.org/D154359
+
+diff --git clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+index 492fe8ba1b14..9e5f85b0f916 100644
+--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
++++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+@@ -5087,6 +5087,10 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
+     // PushDeclContext because we don't have a scope.
+     Sema::ContextRAII savedContext(*this, Function);
+ 
++    FPFeaturesStateRAII SavedFPFeatures(*this);
++    CurFPFeatures = FPOptions(getLangOpts());
++    FpPragmaStack.CurrentValue = FPOptionsOverride();
++
+     if (addInstantiatedParametersToScope(Function, PatternDecl, Scope,
+                                          TemplateArgs))
+       return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307201955.36KJtmtJ053067>