Accepting request 1003284 from devel:tools:statica

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1003284
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/klee?expand=0&rev=32
This commit is contained in:
Dominique Leuenberger 2022-09-13 13:09:59 +00:00 committed by Git OBS Bridge
commit ecadb04ff8
10 changed files with 379 additions and 10 deletions

View File

@ -0,0 +1,65 @@
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Sat, 5 Mar 2022 13:48:35 +0100
Subject: Module/InstructionOperandTypeCheckPass: Fix
-Wbitwise-instead-of-logical warning
Git-repo: https://github.com/lzaoral/klee#llvm14
Git-commit: fc8c581aac41a1b8df23a5f47d70ac2296be7ffc
Patch-mainline: no
References: llvm 14
This warning was introduced in Clang 14.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
lib/Module/InstructionOperandTypeCheckPass.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/Module/InstructionOperandTypeCheckPass.cpp b/lib/Module/InstructionOperandTypeCheckPass.cpp
index 5f428471..e67f051c 100644
--- a/lib/Module/InstructionOperandTypeCheckPass.cpp
+++ b/lib/Module/InstructionOperandTypeCheckPass.cpp
@@ -94,7 +94,7 @@ bool checkInstruction(const Instruction *i) {
// scalarizer pass might not remove these. This could be selecting which
// vector operand to feed to another instruction. The Executor can handle
// this so case so this is not a problem
- return checkOperandTypeIsScalarInt(i, 0) &
+ return checkOperandTypeIsScalarInt(i, 0) &&
checkOperandsHaveSameType(i, 1, 2);
}
// Integer arithmetic, logical and shifting
@@ -111,12 +111,12 @@ bool checkInstruction(const Instruction *i) {
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr: {
- return checkOperandTypeIsScalarInt(i, 0) &
+ return checkOperandTypeIsScalarInt(i, 0) &&
checkOperandTypeIsScalarInt(i, 1);
}
// Integer comparison
case Instruction::ICmp: {
- return checkOperandTypeIsScalarIntOrPointer(i, 0) &
+ return checkOperandTypeIsScalarIntOrPointer(i, 0) &&
checkOperandTypeIsScalarIntOrPointer(i, 1);
}
// Integer Conversion
@@ -136,7 +136,7 @@ bool checkInstruction(const Instruction *i) {
case Instruction::FMul:
case Instruction::FDiv:
case Instruction::FRem: {
- return checkOperandTypeIsScalarFloat(i, 0) &
+ return checkOperandTypeIsScalarFloat(i, 0) &&
checkOperandTypeIsScalarFloat(i, 1);
}
// Floating point conversion
@@ -152,7 +152,7 @@ bool checkInstruction(const Instruction *i) {
}
// Floating point comparison
case Instruction::FCmp: {
- return checkOperandTypeIsScalarFloat(i, 0) &
+ return checkOperandTypeIsScalarFloat(i, 0) &&
checkOperandTypeIsScalarFloat(i, 1);
}
default:
--
2.35.3

View File

@ -0,0 +1,29 @@
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Sat, 5 Mar 2022 13:44:24 +0100
Subject: llvm14: Add LLVM 14 to lit.cfg
Git-repo: https://github.com/lzaoral/klee#llvm14
Git-commit: 87b74ea337994d2a564bd583004ef4ae3d0bd2ce
Patch-mainline: no
References: llvm 14
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
test/lit.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/lit.cfg b/test/lit.cfg
index 4d7382cf..c935ab8e 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -161,7 +161,7 @@ config.substitutions.append(
# Add feature for the LLVM version in use, so it can be tested in REQUIRES and
# XFAIL checks. We also add "not-XXX" variants, for the same reason.
-known_llvm_versions = { "9.0", "10.0", "11.0", "11.1", "12.0", "13.0" }
+known_llvm_versions = { "9.0", "10.0", "11.0", "11.1", "12.0", "13.0", "14.0" }
current_llvm_version_tuple = (int(config.llvm_version_major), int(config.llvm_version_minor))
current_llvm_version = "%s.%s" % current_llvm_version_tuple
--
2.35.3

View File

@ -0,0 +1,32 @@
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Sat, 5 Mar 2022 14:08:11 +0100
Subject: llvm14: TargetRegistry.h was moved from Support to MC
Git-repo: https://github.com/lzaoral/klee#llvm14
Git-commit: fcbec7650d30a39bed145041c6b5e9d996185524
Patch-mainline: no
References: llvm 14
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
lib/Module/RaiseAsm.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 98e580a8..457927f9 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -19,7 +19,11 @@
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Host.h"
+#if LLVM_VERSION_CODE >= LLVM_VERSION(14, 0)
+#include "llvm/MC/TargetRegistry.h"
+#else
#include "llvm/Support/TargetRegistry.h"
+#endif
#include "llvm/Target/TargetMachine.h"
--
2.35.3

View File

@ -0,0 +1,203 @@
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Sat, 5 Mar 2022 16:50:36 +0100
Subject: llvm14: PointerType::getElementType() was deprecated
Git-repo: https://github.com/lzaoral/klee#llvm14
Git-commit: 6caf7f74dd5aedcb39ade5f33a34673d3b6b091f
Patch-mainline: no
References: llvm 14
... for LLVM 14 in [1] and has already been removed from the LLVM 15
branch in [2].
Some changes are only temporary to silence the warning though, as
Type::getPointerElementType() is planned to be removed as well. [3]
[1] https://reviews.llvm.org/D117885/new/
[2] https://github.com/llvm/llvm-project/commit/d593cf7
[3] https://llvm.org/docs/OpaquePointers.html#migration-instructions
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
include/klee/Module/KCallable.h | 5 +++++
include/klee/Module/KModule.h | 4 ++++
lib/Core/Executor.cpp | 30 ++++++++++++----------------
lib/Core/Executor.h | 2 +-
lib/Core/ExternalDispatcher.cpp | 3 +--
lib/Core/GetElementPtrTypeIterator.h | 4 ++--
lib/Module/FunctionAlias.cpp | 6 ++----
7 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/include/klee/Module/KCallable.h b/include/klee/Module/KCallable.h
index bf8b17ea..e25fb5b5 100644
--- a/include/klee/Module/KCallable.h
+++ b/include/klee/Module/KCallable.h
@@ -32,6 +32,7 @@ public:
CallableKind getKind() const { return Kind; }
virtual llvm::StringRef getName() const = 0;
+ virtual llvm::FunctionType *getFunctionType() const = 0;
virtual llvm::PointerType *getType() const = 0;
virtual llvm::Value *getValue() = 0;
@@ -55,6 +56,10 @@ public:
llvm::StringRef getName() const override { return name; }
+ llvm::FunctionType *getFunctionType() const override {
+ return value->getFunctionType();
+ }
+
llvm::PointerType *getType() const override { return value->getType(); }
llvm::Value *getValue() override { return value; }
diff --git a/include/klee/Module/KModule.h b/include/klee/Module/KModule.h
index 71fe8a0a..ca6d2b22 100644
--- a/include/klee/Module/KModule.h
+++ b/include/klee/Module/KModule.h
@@ -64,6 +64,10 @@ namespace klee {
llvm::StringRef getName() const override { return function->getName(); }
+ llvm::FunctionType *getFunctionType() const override {
+ return function->getFunctionType();
+ }
+
llvm::PointerType *getType() const override { return function->getType(); }
llvm::Value *getValue() override { return function; }
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 42405982..661198e7 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -710,7 +710,7 @@ void Executor::allocateGlobalObjects(ExecutionState &state) {
for (const GlobalVariable &v : m->globals()) {
std::size_t globalObjectAlignment = getAllocationAlignment(&v);
- Type *ty = v.getType()->getElementType();
+ Type *ty = v.getValueType();
std::uint64_t size = 0;
if (ty->isSized())
size = kmodule->targetData->getTypeStoreSize(ty);
@@ -2420,10 +2420,9 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
}
if (f) {
- const FunctionType *fType =
- dyn_cast<FunctionType>(cast<PointerType>(f->getType())->getElementType());
+ const FunctionType *fType = f->getFunctionType();
const FunctionType *fpType =
- dyn_cast<FunctionType>(cast<PointerType>(fp->getType())->getElementType());
+ dyn_cast<FunctionType>(fp->getType()->getPointerElementType());
// special case the call with a bitcast case
if (fType != fpType) {
@@ -3324,13 +3323,14 @@ void Executor::updateStates(ExecutionState *current) {
removedStates.clear();
}
-template <typename SqType, typename TypeIt>
+template <typename TypeIt>
void Executor::computeOffsetsSeqTy(KGEPInstruction *kgepi,
ref<ConstantExpr> &constantOffset,
uint64_t index, const TypeIt it) {
- const auto *sq = cast<SqType>(*it);
+ assert(it->getNumContainedTypes() == 1 &&
+ "Sequential type must contain one subtype");
uint64_t elementSize =
- kmodule->targetData->getTypeStoreSize(sq->getElementType());
+ kmodule->targetData->getTypeStoreSize(it->getContainedType(0));
const Value *operand = it.getOperand();
if (const Constant *c = dyn_cast<Constant>(operand)) {
ref<ConstantExpr> index =
@@ -3355,12 +3355,9 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
uint64_t addend = sl->getElementOffset((unsigned) ci->getZExtValue());
constantOffset = constantOffset->Add(ConstantExpr::alloc(addend,
Context::get().getPointerWidth()));
- } else if (isa<ArrayType>(*ii)) {
- computeOffsetsSeqTy<ArrayType>(kgepi, constantOffset, index, ii);
- } else if (isa<VectorType>(*ii)) {
- computeOffsetsSeqTy<VectorType>(kgepi, constantOffset, index, ii);
- } else if (isa<PointerType>(*ii)) {
- computeOffsetsSeqTy<PointerType>(kgepi, constantOffset, index, ii);
+ } else if (isa<ArrayType>(*ii) || isa<VectorType>(*ii) ||
+ isa<PointerType>(*ii)) {
+ computeOffsetsSeqTy(kgepi, constantOffset, index, ii);
} else
assert("invalid type" && 0);
index++;
@@ -4611,10 +4608,9 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const {
alignment = GO->getAlignment();
if (const GlobalVariable *globalVar = dyn_cast<GlobalVariable>(GO)) {
// All GlobalVariables's have pointer type
- llvm::PointerType *ptrType =
- dyn_cast<llvm::PointerType>(globalVar->getType());
- assert(ptrType && "globalVar's type is not a pointer");
- type = ptrType->getElementType();
+ assert(globalVar->getType()->isPointerTy() &&
+ "globalVar's type is not a pointer");
+ type = globalVar->getValueType();
} else {
type = GO->getType();
}
diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h
index 279d8bee..4b88567a 100644
--- a/lib/Core/Executor.h
+++ b/lib/Core/Executor.h
@@ -450,7 +450,7 @@ private:
/// bindModuleConstants - Initialize the module constant table.
void bindModuleConstants();
- template <typename SqType, typename TypeIt>
+ template <typename TypeIt>
void computeOffsetsSeqTy(KGEPInstruction *kgepi,
ref<ConstantExpr> &constantOffset, uint64_t index,
const TypeIt it);
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 7a0d8e14..d286bea9 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -284,8 +284,7 @@ Function *ExternalDispatcherImpl::createDispatcher(KCallable *target,
argI64sp->getType()->getPointerElementType(), argI64sp, "args");
// Get the target function type.
- FunctionType *FTy = cast<FunctionType>(
- cast<PointerType>(target->getType())->getElementType());
+ FunctionType *FTy = target->getFunctionType();
// Each argument will be passed by writing it into gTheArgsP[i].
unsigned i = 0, idx = 2;
diff --git a/lib/Core/GetElementPtrTypeIterator.h b/lib/Core/GetElementPtrTypeIterator.h
index 89606a0a..54fe6a29 100644
--- a/lib/Core/GetElementPtrTypeIterator.h
+++ b/lib/Core/GetElementPtrTypeIterator.h
@@ -88,8 +88,8 @@ class generic_gep_type_iterator
if (llvm::CompositeType *CT = dyn_cast<llvm::CompositeType>(CurTy)) {
CurTy = CT->getTypeAtIndex(getOperand());
#endif
- } else if (auto ptr = dyn_cast<llvm::PointerType>(CurTy)) {
- CurTy = ptr->getElementType();
+ } else if (llvm::isa<llvm::PointerType>(CurTy)) {
+ CurTy = CurTy->getPointerElementType();
} else {
CurTy = 0;
}
diff --git a/lib/Module/FunctionAlias.cpp b/lib/Module/FunctionAlias.cpp
index a98b74fb..aa80b35d 100644
--- a/lib/Module/FunctionAlias.cpp
+++ b/lib/Module/FunctionAlias.cpp
@@ -135,10 +135,8 @@ bool FunctionAliasPass::runOnModule(Module &M) {
const FunctionType *FunctionAliasPass::getFunctionType(const GlobalValue *gv) {
const Type *type = gv->getType();
- while (type->isPointerTy()) {
- const PointerType *ptr = cast<PointerType>(type);
- type = ptr->getElementType();
- }
+ while (type->isPointerTy())
+ type = type->getPointerElementType();
return cast<FunctionType>(type);
}
--
2.35.3

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/klee/klee</param>
<param name="changesrevision">862e0871bcc50eff526f20582f1855bf5788b471</param></service></servicedata>
<param name="changesrevision">39f8069db879e1f859c60c821092452748b4ba37</param></service></servicedata>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26adc0b0036be333b1300124b1c59c575a0c1eee66f6d13521b408d99ca2e691
size 19623949

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:85284e91056896035b0324383c51878b9f6e1964e2838c8796999460fef9a4d3
size 19618317

View File

@ -1,3 +1,40 @@
-------------------------------------------------------------------
Tue Sep 6 09:21:23 UTC 2022 - Jiri Slaby <jslaby@suse.cz>
- add llvm 14 support
* 0001-llvm14-Add-LLVM-14-to-lit.cfg.patch
* 0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch
* 0002-llvm14-TargetRegistry.h-was-moved-from-Support-to-MC.patch
* 0003-llvm14-PointerType-getElementType-was-deprecated.patch
- switch to llvm 14
-------------------------------------------------------------------
Mon Sep 05 09:12:26 UTC 2022 - jslaby@suse.cz
- Update to version 2.3+20220826:
* Use true instead of Z3_TRUE (removed in z3 4.11.0)
* Corrected wrong usage of klee_report_error in __cxa_atexit handler
* Support arguments of width 128, 256 and 512 bits for external calls
* POSIX runtime: fstatat: check for nonnull path APIs
* Inline asm external call
* Fix memory leak in crosscheck core solver mechanism
* checkout KLEE with depth > 1 when running codecov
* rename CallSite to CallBase
* remove LLVM < 9
* Perform coverage analysis for z3 as well
* Remove the CI target metaSMT(Boolector). metaSMT(STP) already runs the
test suite with all solvers supported by metaSMT, so the extra target
provides marginal benefits.
* Implement getArrayForUpdate iteratively
* Fix error with empty EntryPoint
* Intrinsics: Add support for @llvm.f{ma,muladd}.f*
* Use `klee` user to install system dependencies
* Spelling Fixes
* tests: add StackTraceOutput.c
* .err files: minor readability changes to stack trace output
* Update SpecialFunctionHandler.cpp
* tests: invoke LLVM tools through their corresponding macros
-------------------------------------------------------------------
Tue May 10 09:23:08 UTC 2022 - jslaby@suse.cz

View File

@ -1,4 +1,4 @@
name: klee
version: 2.3+20220506
mtime: 1651864460
commit: 862e0871bcc50eff526f20582f1855bf5788b471
version: 2.3+20220826
mtime: 1661511934
commit: 39f8069db879e1f859c60c821092452748b4ba37

View File

@ -16,7 +16,7 @@
#
%define llvm_version_major 13
%define llvm_version_major 14
%define llvm_version %{llvm_version_major}
%ifarch x86_64
@ -31,7 +31,7 @@ Name: klee
Summary: LLVM Execution Engine
License: NCSA
Group: Development/Languages/Other
Version: 2.3+20220506
Version: 2.3+20220826
Release: 0
URL: http://klee.github.io/
Source0: %{name}-%{version}.tar.xz
@ -39,7 +39,10 @@ Source1: %{name}-rpmlintrc
Source2: https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-%{llvm_version_major}.0.0/llvm/utils/not/not.cpp
Source3: https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-%{llvm_version_major}.0.0/llvm/utils/FileCheck/FileCheck.cpp
Patch0: 0001-test-disable-until-it-is-fixed.patch
Patch1: 0001-llvm14-Add-LLVM-14-to-lit.cfg.patch
Patch2: 0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch
Patch3: 0002-llvm14-TargetRegistry.h-was-moved-from-Support-to-MC.patch
Patch4: 0003-llvm14-PointerType-getElementType-was-deprecated.patch
BuildRequires: clang%{llvm_version}
BuildRequires: cmake
BuildRequires: gperftools-devel