Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ec57ad7
added benchmarks for floats
dannem1337 Mar 28, 2023
03516eb
added support for NAN and INF in parser
dannem1337 Mar 29, 2023
60b7fae
Began making some changes in the code, don't know how to endode Fract…
dannem1337 Apr 11, 2023
9f4dc9c
added double2fraction and float2fraction, float2fraction seems to wor…
dannem1337 Apr 13, 2023
51affeb
Fixed bug in 2fraction
dannem1337 Apr 19, 2023
ab4f4e1
Adds ADT encoding for floats and helper methods
zafer-esen Apr 19, 2023
88eab10
Move everything that is floatADT related to FloatADT.
zafer-esen Apr 19, 2023
35bcaee
added Rational operators, does not work yet, unsure why
dannem1337 Apr 21, 2023
5475616
added tests and answers
dannem1337 Apr 21, 2023
c59fbed
changed isFloat etc in floatADT
dannem1337 Apr 24, 2023
8b9c91a
merge
dannem1337 Apr 25, 2023
e46130c
Merge remote-tracking branch 'upstream/master'
dannem1337 Apr 25, 2023
ed81d88
bug sort is int
dannem1337 Apr 25, 2023
77ac572
Fixes some issues in encoding floats
zafer-esen Apr 25, 2023
93c558b
fixed some bugs
dannem1337 Apr 25, 2023
64764d9
added a test and added small support for NaN
dannem1337 Apr 26, 2023
04da5b1
added some support for doubles and did some refactoring for them
dannem1337 Apr 26, 2023
579437f
added small changes and added some tests
dannem1337 May 3, 2023
d36885b
Bug in both long double and double
dannem1337 May 7, 2023
09f1bef
doubles shoudl be working, still issues with long doubles
dannem1337 May 8, 2023
7c873fc
Long doubles are now correcty parsed
dannem1337 May 9, 2023
18e79b5
added some more tests
dannem1337 May 11, 2023
3809d87
added more tests
dannem1337 May 23, 2023
0e9f1f7
branch for the presentation
dannem1337 Jun 15, 2023
e044b66
final changes
dannem1337 Jun 15, 2023
15266e5
Merge pull request #1 from dannem1337/presentation
dannem1337 Jun 15, 2023
66f7d67
final commit
dannem1337 Sep 8, 2023
28aa662
fixed tests
dannem1337 Oct 18, 2023
ec5ec8e
Merge pull request #2 from dannem1337/presentation
dannem1337 Oct 18, 2023
2e82b6e
Merge branch 'uuverifiers:master' into master
dannem1337 Oct 18, 2023
42d471b
all tests pass
dannem1337 Oct 18, 2023
057cdba
changes according to review
dannem1337 Oct 26, 2023
cddb648
Merge branch 'master' into dannem1337/master
zafer-esen Feb 12, 2024
2b78b30
sync with main
jesper-amilon Mar 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ preprocessor/build
tri-pp
*.swp
*.swo
.attach_pid*
Binary file modified acsl-parser/acsl-parser.jar
Binary file not shown.
Binary file modified cc-parser/cc-parser.jar
Binary file not shown.
13 changes: 5 additions & 8 deletions cc-parser/concurrentC.cf
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ token OctalLong '0'["01234567"]* ('l'|'L');

token OctalUnsLong '0'["01234567"]* (('u''l')|('U''L'));

token CDouble (((digit+ '.')|('.' digit+))(('e'|'E') ('-')? digit+)?)|
(digit+ ('e'|'E') ('-')? digit+)|(digit+ '.' digit+ 'E' ('-')? digit+);
token CDouble (((digit+ '.' digit+)|(digit+ '.')|('.' digit+))(('e'|'E')('-')? digit+)?
)|((digit+ ('e'|'E')('-')? digit+));

token CFloat (((digit+ '.' digit+)|(digit+ '.')|('.' digit+))(('e'|'E')('-')? digit+)?
('f'|'F'))|((digit+ ('e'|'E')('-')? digit+)('f'|'F'));
Expand Down Expand Up @@ -354,7 +354,7 @@ Econst. Exp17 ::= Constant;
Estring. Exp17 ::= String;
Enondet. Exp17 ::= "_";

Efloat. Constant ::= Double;
Einf. Constant ::= "INFINITY";
Echar. Constant ::= Char;
Eunsigned. Constant ::= Unsigned;
Elong. Constant ::= Long;
Expand All @@ -367,13 +367,10 @@ Eoctal. Constant ::= Octal;
Eoctalunsign. Constant ::= OctalUnsigned;
Eoctallong. Constant ::= OctalLong;
Eoctalunslong. Constant ::= OctalUnsLong;
Ecdouble. Constant ::= CDouble;
Ecfloat. Constant ::= CFloat;
Ecdouble. Constant ::= CDouble;
Eclongdouble. Constant ::= CLongDouble;
Eint. Constant ::= UnboundedInteger;

-- internal Elonger. Constant ::= Integer;
-- internal Edouble. Constant ::= Double;
Eint. Constant ::= UnboundedInteger;

Especial. Constant_expression ::= Exp3;

Expand Down
42 changes: 42 additions & 0 deletions regression-tests/double/Answers
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

add_1.c
SAFE

add_2.c
UNSAFE

add_3.c
UNSAFE

div_1.c
SAFE

div_2.c
UNSAFE

div_3.c
SAFE

init_1.c
SAFE

init_2.c
SAFE

mul_1.c
SAFE

mul_2.c
UNSAFE

loop_1.c
SAFE

loop_2.c
UNSAFE

sub_1.c
SAFE

sub_2.c
UNSAFE
7 changes: 7 additions & 0 deletions regression-tests/double/add_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SAFE
int main () {
double a = 0.22;
double b = 0.1;
assert(a+b== 0.32);
return 0;
}
7 changes: 7 additions & 0 deletions regression-tests/double/add_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//UNSAFE
int main() {
double a = 3.0;
double b = 0.5;
assert(a+b == 3.501);
return 0;
}
6 changes: 6 additions & 0 deletions regression-tests/double/add_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//UNSAFE
int main() {
double a = 2.0;
double b = a + 0.5;
assert(a + 0.4 == b);
}
7 changes: 7 additions & 0 deletions regression-tests/double/div_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//SAFE
int main () {
double a = 4.0;
double b = 0.5;
assert(a/b== 8.0);
return 0;
}
7 changes: 7 additions & 0 deletions regression-tests/double/div_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//UNSAFE
int main () {
double a = 4.0;
double b = 0.5;
assert(a/b== 8.01);
return 0;
}
7 changes: 7 additions & 0 deletions regression-tests/double/div_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
int main () {
double a = 4.0;
double b = 0.1;
assert(a/b <= 40.00001);
assert(a/b >= 39.99999);
return 0;
}
7 changes: 7 additions & 0 deletions regression-tests/double/init_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//SAFE
int main() {
double a = 0.0;
assert(a == 0.0);
return 0;

}
6 changes: 6 additions & 0 deletions regression-tests/double/init_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//SAFE
int main() {
double a = 4.24242;
assert(a == 4.24242);
return 0;
}
7 changes: 7 additions & 0 deletions regression-tests/double/init_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//UNSAFE
int main() {
double a = 4.24242;
assert(a == 4.24241);
return 0;

}
7 changes: 7 additions & 0 deletions regression-tests/double/int_plus_float.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//SAFE
int main () {
double a = 2.0;
int b = 1;
assert(a+b == 3.0);
return 0;
}
6 changes: 6 additions & 0 deletions regression-tests/double/leq_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//SAFE
int main() {
double a = 2.3;
double b = 2.25;;
assert(b <= a);
}
12 changes: 12 additions & 0 deletions regression-tests/double/loop_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//SAFE
void main(void) {
int i = 0;
double x = 0.5;
double y = x;
while (x < 3000.0) {
x = x*2.0;
y = x;
++i;
}
assert(x==y);
}
15 changes: 15 additions & 0 deletions regression-tests/double/loop_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//UNSAFE
int N = _;

void main(void) {
int i = 0;
double x = 0.5;
double y = x;
while (i < N) {
if(x == y) {
x = x+2.25;
}
++i;
}
assert(x==y);
}
7 changes: 7 additions & 0 deletions regression-tests/double/mul_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//SAFE
int main () {
double a = 0.5;
double b = 0.5;
assert(a*b== 0.25);
return 0;
}
6 changes: 6 additions & 0 deletions regression-tests/double/mul_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int main () {
double a = 0.5;
double b = 0.5;
assert(a*b== 0.251);
return 0;
}
8 changes: 8 additions & 0 deletions regression-tests/double/nan.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//UNSAFE IF NAN IS INCLUDED OTHERWISE SAFE
int main()
{
double x = _;

assert(x==x);
return 0;
}
5 changes: 5 additions & 0 deletions regression-tests/double/nan_create.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//UNSAFE
int main() {
double nan = 0/0;
assert(nan == 2);
}
10 changes: 10 additions & 0 deletions regression-tests/double/nan_range.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SAFE
int main() {
double x = _;

if (x >= -0.00001 && x <= -0.00001) {
assert(x==x);
}
return 0;
}

7 changes: 7 additions & 0 deletions regression-tests/double/nondet_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SAFE
int main() {
double x = _;
double y = x + 1.0;
assert(y>x);

}
6 changes: 6 additions & 0 deletions regression-tests/double/nondet_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// UNSAFE
int main() {
double x = _;
double y = x + 1.0;
assert(y<x);
}
25 changes: 25 additions & 0 deletions regression-tests/double/runtests
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

LAZABS=../../tri

TESTS="add_1.c \
add_2.c \
add_3.c \
div_1.c \
div_2.c \
div_3.c \
init_1.c \
init_2.c \
mul_1.c \
mul_2.c \
loop_1.c \
loop_2.c \
sub_1.c \
sub_2.c "

for name in $TESTS; do
echo
echo $name
$LAZABS "$@" $name 2>&1 | grep -v 'at '
done

8 changes: 8 additions & 0 deletions regression-tests/double/sub_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//SAFE
int main() {
double a = 1.5;
double b = 0.5;
assert(a-b== 1.0);
return 0;

}
7 changes: 7 additions & 0 deletions regression-tests/double/sub_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// UNSAFE
int main() {
double a = 0.22;
double b = 0.1;
assert(a-b == 0.1);
return 0;
}
39 changes: 39 additions & 0 deletions regression-tests/float/Answers
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

add_1.c
SAFE

add_2.c
SAFE

add_3.c
UNSAFE

div_1.c
SAFE

div_2.c
SAFE

init_1.c
SAFE

init_2.c
SAFE

loop_1.c
SAFE

loop_2.c
UNSAFE

mul_1.c
SAFE

mul_2.c
UNSAFE

sub_1.c
SAFE

sub_2.c
UNSAFE
6 changes: 6 additions & 0 deletions regression-tests/float/add_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int main () {
float a = 0.5f;
float b = 0.75f;
assert(a+b== 1.25f);
return 0;
}
6 changes: 6 additions & 0 deletions regression-tests/float/add_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int main() {
float a = 3.0f;
float b = 0.5f;
assert(a+b == 3.5f);
return 0;
}
5 changes: 5 additions & 0 deletions regression-tests/float/add_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int main() {
float a = 2.0f;
float b = a + 0.5f;
assert(a + 0.4f == b);
}
7 changes: 7 additions & 0 deletions regression-tests/float/div_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
int main () {
float a = 4.0f;
float b = 0.1f;
assert(a/b <= 40.00001f);
assert(a/b >= 39.99999f);
return 0;
}
6 changes: 6 additions & 0 deletions regression-tests/float/div_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int main () {
float a = 4.0f;
float b = 0.5f;
assert(a/b== 8.0f);
return 0;
}
10 changes: 10 additions & 0 deletions regression-tests/float/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
int main() {
int x = 0;
int y = 3;
while(x <= 2) {
x++;
y = x;
}
assert(x==y);
}

Loading