Skip to content

Commit 0a990ef

Browse files
committed
Do not (unnecessarily) require preprocessing for fixed 32/64 bit regression tests
This is not portable as some architectures might not provide header files for non-native bit widths. Preprocessing/the use of header files is not essential for any of these regression tests.
1 parent 0d7a943 commit 0a990ef

File tree

28 files changed

+100
-151
lines changed

28 files changed

+100
-151
lines changed

.travis.yml

-7
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ jobs:
101101
- g++-5
102102
- libubsan0
103103
- parallel
104-
- libc6-dev-i386
105104
before_install:
106105
- mkdir bin
107106
- ln -s /usr/bin/gcc-5 bin/gcc
@@ -136,7 +135,6 @@ jobs:
136135
- libwww-perl
137136
- g++-5
138137
- libubsan0
139-
- libc6-dev-i386
140138
before_install:
141139
- mkdir bin
142140
- ln -s /usr/bin/gcc-5 bin/gcc
@@ -165,7 +163,6 @@ jobs:
165163
- libstdc++-5-dev
166164
- libubsan0
167165
- parallel
168-
- libc6-dev-i386
169166
before_install:
170167
- mkdir bin
171168
- ln -s /usr/bin/gcc-5 bin/gcc
@@ -194,7 +191,6 @@ jobs:
194191
- g++-5
195192
- libstdc++-5-dev
196193
- libubsan0
197-
- libc6-dev-i386
198194
before_install:
199195
- mkdir bin
200196
- ln -s /usr/bin/gcc-5 bin/gcc
@@ -220,7 +216,6 @@ jobs:
220216
- ubuntu-toolchain-r-test
221217
packages:
222218
- g++-5
223-
- libc6-dev-i386
224219
before_install:
225220
- mkdir bin
226221
- ln -s /usr/bin/gcc-5 bin/gcc
@@ -245,7 +240,6 @@ jobs:
245240
- ubuntu-toolchain-r-test
246241
packages:
247242
- g++-7
248-
- libc6-dev-i386
249243
before_install:
250244
- mkdir bin
251245
- ln -s /usr/bin/gcc-7 bin/gcc
@@ -276,7 +270,6 @@ jobs:
276270
- libstdc++-5-dev
277271
- libubsan0
278272
- parallel
279-
- libc6-dev-i386
280273
before_install:
281274
- mkdir bin
282275
# Use gcc/g++ 5 for tests, as Clang doesn't work yet
File renamed without changes.

regression/cbmc/Float24/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--win32 --xml-ui
44
^EXIT=10$
55
^SIGNAL=0$
File renamed without changes.

regression/cbmc/Malloc15/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32
44
^EXIT=0$
55
^SIGNAL=0$
File renamed without changes.

regression/cbmc/Malloc16/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32
44
^EXIT=0$
55
^SIGNAL=0$

regression/cbmc/Pointer_Arithmetic12/main.c renamed to regression/cbmc/Pointer_Arithmetic12/main.i

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#include <stdint.h>
2-
3-
#include <assert.h>
1+
typedef unsigned int uint32_t;
42

53
uint32_t __stack[32];
64

@@ -98,35 +96,25 @@ int main()
9896
L_0x401_0: esp-=0x14;
9997
L_0x404_0: var15=ebp;
10098
L_0x404_1: var15-=0x4;
101-
#ifdef NONDET
102-
L_0x404_2: *(uint32_t*)(var15)=nondet_uint();
103-
#else
10499
L_0x404_2: *(uint32_t*)(var15)=0xffffffff;
105-
#endif
106100
L_0x40b_0: var16=ebp;
107101
L_0x40b_1: var16-=0x4;
108102
L_0x40b_2: eax=*(uint32_t*)(var16);
109103
L_0x40e_0: *(uint32_t*)(esp)=eax;
110104
L_0x411_0: esp-=4; f__L_0x3c6_0(); esp+=4;
111-
#if 1
112105
uint32_t eax1=eax;
113106
C_0x3ff_0: ebp=esp;
114107
C_0x401_0: esp-=0x14;
115108
C_0x404_0: var15=ebp;
116109
C_0x404_1: var15-=0x4;
117-
#ifdef NONDET
118-
C_0x404_2: *(uint32_t*)(var15)=nondet_uint();
119-
#else
120110
C_0x404_2: *(uint32_t*)(var15)=0xffffffff;
121-
#endif
122111
C_0x40b_0: var16=ebp;
123112
C_0x40b_1: var16-=0x4;
124113
C_0x40b_2: eax=*(uint32_t*)(var16);
125114
C_0x40e_0: *(uint32_t*)(esp)=eax;
126115
C_0x411_0: esp-=4; f__L_0x3c6_0(); esp+=4;
127116
uint32_t eax2=eax;
128-
assert(eax2==eax1);
129-
#endif
117+
__CPROVER_assert(eax2 == eax1, "");
130118
L_0x416_0: esp=ebp;
131119
L_0x416_1: ebp=*(uint32_t*)(esp);
132120
L_0x416_2: esp+=0x4;

regression/cbmc/Pointer_Arithmetic12/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32 --little-endian
44
^EXIT=0$
55
^SIGNAL=0$
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <assert.h>
2-
31
int main()
42
{
53
int arrayOfIntegers[] = {1, 2, 3};
@@ -8,6 +6,6 @@ int main()
86
int iFirst=(int)pointer2FirstElem;
97
int iThird=(int)pointer2ThirdElem;
108
int addrDiff = iThird-iFirst;
11-
assert(addrDiff == 2* sizeof(int));
9+
__CPROVER_assert(addrDiff == 2* sizeof(int), "");
1210
return 0;
1311
}

regression/cbmc/Pointer_array4/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32
44
^EXIT=0$
55
^SIGNAL=0$

regression/cbmc/Pointer_byte_extract5/main.c renamed to regression/cbmc/Pointer_byte_extract5/main.i

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ typedef union
66
int b;
77
} Union;
88

9-
#ifdef __GNUC__
10-
typedef struct
11-
{
12-
int Count;
13-
Union List[1];
14-
} __attribute__((packed)) Struct3;
15-
#else
9+
#pragma pack(push)
10+
#pragma pack(1)
1611
typedef struct
1712
{
1813
int Count;
1914
Union List[1];
2015
} Struct3;
21-
#endif
16+
#pragma pack(pop)
2217

2318
int main()
2419
{

regression/cbmc/Pointer_byte_extract5/no-simplify.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--bounds-check --32 --no-simplify
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Pointer_byte_extract5/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--bounds-check --32
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Pointer_byte_extract8/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
KNOWNBUG
2-
main.c
2+
main.i
33
--bounds-check --32 --no-simplify
44
^EXIT=0$
55
^SIGNAL=0$

regression/cbmc/Struct_Padding1/main.c renamed to regression/cbmc/Struct_Padding1/main.i

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
#include <assert.h>
2-
3-
#define STATIC_ASSERT(condition) \
4-
int some_array##__LINE__[(condition) ? 1 : -1]
5-
61
struct my_struct1
72
{
83
int i;
@@ -40,22 +35,22 @@ struct my_struct3 {
4035
int i;
4136
} xx3= { 1, 2 };
4237

43-
STATIC_ASSERT(sizeof(xx1)==4+1+3+4+4);
44-
STATIC_ASSERT(sizeof(xx2)==4+4+4+4);
38+
int some_array1[(sizeof(xx1)==4+1+3+4+4) ? 1 : -1];
39+
int some_array2[(sizeof(xx2)==4+4+4+4) ? 1 : -1];
4540

4641
int main()
4742
{
48-
assert(xx1.i==1);
49-
assert(xx1.ch==2);
50-
assert(xx1.j==3);
43+
__CPROVER_assert(xx1.i==1, "");
44+
__CPROVER_assert(xx1.ch==2, "");
45+
__CPROVER_assert(xx1.j==3, "");
5146

5247
// let's probe the padding
5348
char *p=&xx1.ch;
54-
assert(p[0]==2);
55-
assert(p[1]==0);
56-
assert(p[2]==0);
57-
assert(p[3]==0);
49+
__CPROVER_assert(p[0]==2, "");
50+
__CPROVER_assert(p[1]==0, "");
51+
__CPROVER_assert(p[2]==0, "");
52+
__CPROVER_assert(p[3]==0, "");
5853

59-
assert(xx3.bit_field==1);
60-
assert(xx3.i==2);
54+
__CPROVER_assert(xx3.bit_field==1, "");
55+
__CPROVER_assert(xx3.i==2, "");
6156
}

regression/cbmc/Struct_Padding1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32
44
^EXIT=0$
55
^SIGNAL=0$

regression/cbmc/Visual_Studio_Types1/main.c

-48
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
int main()
2+
{
3+
// these types are Visual Studio-specific
4+
__int8 i1;
5+
__int16 i2;
6+
__int32 i3;
7+
__int64 i4;
8+
9+
__CPROVER_assert(sizeof(i1) == 1, "");
10+
__CPROVER_assert(sizeof(i2) == 2, "");
11+
__CPROVER_assert(sizeof(i3) == 4, "");
12+
__CPROVER_assert(sizeof(i4) == 8, "");
13+
14+
// general types
15+
16+
char c;
17+
short s;
18+
int i;
19+
long l;
20+
long long ll;
21+
22+
__CPROVER_assert(sizeof(c) == 1, "");
23+
__CPROVER_assert(sizeof(s) == 2, "");
24+
__CPROVER_assert(sizeof(i) == 4, "");
25+
__CPROVER_assert(sizeof(l) == 4, "");
26+
__CPROVER_assert(sizeof(ll) == 8, "");
27+
28+
// these constants are Visual Studio-specific
29+
__CPROVER_assert(sizeof(1i8) == 1, "");
30+
__CPROVER_assert(sizeof(1i16) == 2, "");
31+
__CPROVER_assert(sizeof(1i32) == 4, "");
32+
__CPROVER_assert(sizeof(1i64) == 8, "");
33+
__CPROVER_assert(sizeof(1i128) == 16, "");
34+
35+
// oh, and these pointer qualifiers are Visual Studio-specific
36+
int * __ptr32 p32;
37+
//int * __ptr64 p64;
38+
39+
// requires --i386-win32 to work
40+
__CPROVER_assert(sizeof(p32) == 4, "");
41+
//__CPROVER_assert(sizeof(p64) == 8, "");
42+
43+
__CPROVER_assert(sizeof(void *) == 4, "");
44+
}

regression/cbmc/Visual_Studio_Types1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--i386-win32
44
^EXIT=0$
55
^SIGNAL=0$

regression/cbmc/Visual_Studio_Types2/main.c

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
int main()
2+
{
3+
// general types
4+
short s;
5+
int i;
6+
long l;
7+
long long ll;
8+
9+
__CPROVER_assert(sizeof(s) == 2, "");
10+
__CPROVER_assert(sizeof(i) == 4, "");
11+
__CPROVER_assert(sizeof(l) == 4, "");
12+
__CPROVER_assert(sizeof(ll) == 8, "");
13+
14+
// oh, and these pointer qualifiers are MS-specific
15+
int * __ptr32 p32;
16+
int * __ptr64 p64;
17+
18+
// requires --winx64 to work
19+
__CPROVER_assert(sizeof(p32) == 4, "");
20+
__CPROVER_assert(sizeof(p64) == 8, "");
21+
22+
__CPROVER_assert(sizeof(void *) == 8, "");
23+
}

0 commit comments

Comments
 (0)