58 lines
2.6 KiB
Diff
58 lines
2.6 KiB
Diff
|
From b052843655f90a62526585db20fcf18660919cb6 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= <daniel.marjamaki@gmail.com>
|
||
|
Date: Sun, 4 Oct 2020 11:21:00 +0200
|
||
|
Subject: [PATCH] exprengine: Use and tweak ExprEngine::ArrayValue::MAXSIZE
|
||
|
|
||
|
---
|
||
|
lib/exprengine.cpp | 2 +-
|
||
|
lib/exprengine.h | 2 +-
|
||
|
test/testexprengine.cpp | 4 ++--
|
||
|
3 files changed, 4 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp
|
||
|
index 49ea76b4ab..21c6bd9a9f 100644
|
||
|
--- a/lib/exprengine.cpp
|
||
|
+++ b/lib/exprengine.cpp
|
||
|
@@ -1506,7 +1506,7 @@ static ExprEngine::ValuePtr getValueRangeFromValueType(const ValueType *valueTyp
|
||
|
value = getValueRangeFromValueType(&vt, data);
|
||
|
} else
|
||
|
return ExprEngine::ValuePtr();
|
||
|
- auto bufferSize = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ~0U);
|
||
|
+ auto bufferSize = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ExprEngine::ArrayValue::MAXSIZE);
|
||
|
return std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), bufferSize, value, false, false, false);
|
||
|
}
|
||
|
return getValueRangeFromValueType(data.getNewSymbolName(), valueType, *data.settings);
|
||
|
diff --git a/lib/exprengine.h b/lib/exprengine.h
|
||
|
index 46966d6108..889140fd85 100644
|
||
|
--- a/lib/exprengine.h
|
||
|
+++ b/lib/exprengine.h
|
||
|
@@ -194,7 +194,7 @@ namespace ExprEngine {
|
||
|
// Array or pointer
|
||
|
class ArrayValue: public Value {
|
||
|
public:
|
||
|
- const int MAXSIZE = 0x100000;
|
||
|
+ enum { MAXSIZE = 0x7fffffff };
|
||
|
|
||
|
ArrayValue(const std::string &name, ValuePtr size, ValuePtr value, bool pointer, bool nullPointer, bool uninitPointer);
|
||
|
ArrayValue(DataBase *data, const Variable *var);
|
||
|
diff --git a/test/testexprengine.cpp b/test/testexprengine.cpp
|
||
|
index f403eae35c..d8965167a1 100644
|
||
|
--- a/test/testexprengine.cpp
|
||
|
+++ b/test/testexprengine.cpp
|
||
|
@@ -328,13 +328,13 @@ class TestExprEngine : public TestFixture {
|
||
|
Settings settings;
|
||
|
LOAD_LIB_2(settings.library, "std.cfg");
|
||
|
|
||
|
- ASSERT_EQUALS("1:26: $3=0:ffffffff\n"
|
||
|
+ ASSERT_EQUALS("1:26: $3=0:2147483647\n"
|
||
|
"1:26: $2=-128:127\n"
|
||
|
"1:27: 0:{ s=($4,[$3],[:]=$2)}\n",
|
||
|
trackExecution("void foo() { std::string s; }", &settings));
|
||
|
|
||
|
|
||
|
- ASSERT_EQUALS("1:52: $3=0:ffffffff\n"
|
||
|
+ ASSERT_EQUALS("1:52: $3=0:2147483647\n"
|
||
|
"1:52: $2=-128:127\n"
|
||
|
"1:66: 0:{ s=($4,[$3],[:]=$2)}\n",
|
||
|
trackExecution("std::string getName(int); void foo() { std::string s = getName(1); }", &settings));
|