Skip to content

Commit 2d832db

Browse files
committed
C++: Accept test changes.
1 parent 9807c0b commit 2d832db

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ int test13(char c, int i) {
195195
int z = i+1; // $ overflow=+
196196
range(z); // $ range="==InitializeParameter: i+1"
197197
range(c + i + uc + x + y + z); // $ overflow=+- overflow=+ overflow=- MISSING: range=>=1
198-
range((double)(c + i + uc + x + y + z)); // $ overflow=+ overflow=+- overflow=- MISSING: range=>=1
198+
range((double)(c + i + uc + x + y + z)); // $ overflow=+ overflow=+- overflow=- range=<=4294967295 MISSING: range=>=1
199199
return (double)(c + i + uc + x + y + z); // $ overflow=+- overflow=+ overflow=-
200200
}
201201

202202
// Regression test for ODASA-6013.
203203
int test14(int x) {
204204
int x0 = (int)(char)x;
205-
range(x0);
205+
range(x0); // $ range=<=127 range=>=-128
206206
int x1 = (int)(unsigned char)x;
207-
range(x1);
207+
range(x1); // $ range=<=255 range=>=0
208208
int x2 = (int)(unsigned short)x;
209-
range(x2);
209+
range(x2); // $ range=<=65535 range=>=0
210210
int x3 = (int)(unsigned int)x;
211211
range(x3);
212212
char c0 = x;
@@ -759,9 +759,9 @@ unsigned long mult_overflow() {
759759
unsigned long mult_lower_bound(unsigned int ui, unsigned long ul) {
760760
if (ui >= 10) {
761761
range(ui); // $ range=>=10
762-
range((unsigned long)ui); // $ range=>=10
763-
unsigned long result = (unsigned long)ui * ui; // $ overflow=+
764-
range(result); // $ MISSING: range=>=100
762+
range((unsigned long)ui); // $ range=>=10 range=<=4294967295
763+
unsigned long result = (unsigned long)ui * ui; // no overflow
764+
range(result); // $ range=>=100 range=<=18446744065119617024
765765
return result; // BUG: upper bound should be >= 18446744065119617025
766766
}
767767
if (ul >= 10) {
@@ -888,7 +888,7 @@ void notequal_variations(short n, float f) {
888888
}
889889

890890
if (n >= 5) {
891-
if (2 * n - 10 == 0) { // $ overflow=+
891+
if (2 * n - 10 == 0) { // no overflow
892892
range(n); // $ range=>=5 MISSING: range===5
893893
return;
894894
}
@@ -936,7 +936,7 @@ void two_bounds_from_one_test(short ss, unsigned short us) {
936936
range(ss); // -32768 .. 32767
937937
}
938938

939-
if (ss + 1 < sizeof(int)) { // $ overflow=+
939+
if (ss + 1 < sizeof(int)) { // $ overflow=-
940940
range(ss); // -1 .. 2
941941
}
942942
}

0 commit comments

Comments
 (0)