[llvm-branch-commits] [clang] release/23.x: [SSAF] Fix Expected return type in TypeConstrainedPointers deserialization (gcc 7.5.0) (PR #216677)

Jozef Sztabinski via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 17 02:52:15 PDT 2026


https://github.com/jszt1 created https://github.com/llvm/llvm-project/pull/216677

Backport of: https://github.com/llvm/llvm-project/commit/8b0eab156025a55819868daf76ff32e28829d06a

Without this change build breaks on older GCCs (minimum required for implicit move on return is GCC 8.1).
Backporting this change **fixes build failures** with SLES15.4 which uses a system compiler of GCC7.5

>From 1d46ead200f1a8729dfa3f5d6fbef0086d096830 Mon Sep 17 00:00:00 2001
From: Nikita Kornev <nikita.kornev at intel.com>
Date: Thu, 23 Jul 2026 21:28:26 +0200
Subject: [PATCH] [SSAF] Fix Expected return type in TypeConstrainedPointers
 deserialization (gcc 7.5.0) (#211331)

GCC 7.5.0 fails to compile this code. Use explicit upcasts from
std::unique_ptr<Derived> to std::unique_ptr<Base> in deserializeSummary
and deserializeAnalysisResult. This resolves a compilation error where
llvm::Expected<std::unique_ptr<Base>> could not be constructed from
unique_ptr of derived summary/result types.
---
 .../TypeConstrainedPointers/TypeConstrainedPointers.cpp       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp b/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
index 8e6d1c4507e26..26f010824e85f 100644
--- a/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
+++ b/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
@@ -212,7 +212,7 @@ deserializeSummary(const llvm::json::Object &Data, EntityIdTable &,
       std::make_unique<TypeConstrainedPointersEntitySummary>();
 
   Sum->Entities = std::move(*EntityIDSet);
-  return Sum;
+  return std::unique_ptr<EntitySummary>(std::move(Sum));
 }
 
 struct TypeConstrainedPointersJSONFormatInfo final : JSONFormat::FormatInfo {
@@ -246,7 +246,7 @@ deserializeAnalysisResult(const llvm::json::Object &Data,
       std::make_unique<TypeConstrainedPointersAnalysisResult>();
 
   AR->Entities = std::move(*EntityIDSet);
-  return AR;
+  return std::unique_ptr<AnalysisResult>(std::move(AR));
 }
 
 JSONFormat::AnalysisResultRegistry::Add<TypeConstrainedPointersAnalysisResult>



More information about the llvm-branch-commits mailing list