Skip to content

Commit 9b809be

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 8187bdd commit 9b809be

File tree

26 files changed

+39
-84
lines changed

26 files changed

+39
-84
lines changed

.travis.yml

Lines changed: 0 additions & 7 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 14 deletions
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

Lines changed: 1 addition & 1 deletion
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$
Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 8 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 11 additions & 16 deletions
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

Lines changed: 1 addition & 1 deletion
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 renamed to regression/cbmc/Visual_Studio_Types1/main.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
int main()
22
{
33
// these types are Visual Studio-specific
4-
#ifdef _MSC_VER
4+
/* #ifdef _MSC_VER */
55
__int8 i1;
66
__int16 i2;
77
__int32 i3;
@@ -11,7 +11,7 @@ int main()
1111
assert(sizeof(i2)==2);
1212
assert(sizeof(i3)==4);
1313
assert(sizeof(i4)==8);
14-
#endif
14+
/* #endif */
1515

1616
// general types
1717

@@ -28,7 +28,7 @@ int main()
2828
assert(sizeof(ll)==8);
2929

3030
// these constants are Visual Studio-specific
31-
#ifdef _MSC_VER
31+
/* #ifdef _MSC_VER */
3232
assert(sizeof(1i8)==1);
3333
assert(sizeof(1i16)==2);
3434
assert(sizeof(1i32)==4);
@@ -42,7 +42,7 @@ int main()
4242
// requires --i386-win32 to work
4343
assert(sizeof(p32)==4);
4444
//assert(sizeof(p64)==8);
45-
#endif
45+
/* #endif */
4646

4747
assert(sizeof(void *)==4);
4848
}

regression/cbmc/Visual_Studio_Types1/test.desc

Lines changed: 1 addition & 1 deletion
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 renamed to regression/cbmc/Visual_Studio_Types2/main.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ int main()
1212
assert(sizeof(ll)==8);
1313

1414
// oh, and these pointer qualifiers are MS-specific
15-
#ifdef _MSC_VER
15+
/* #ifdef _MSC_VER */
1616
int * __ptr32 p32;
1717
int * __ptr64 p64;
1818

1919
// requires --winx64 to work
2020
assert(sizeof(p32)==4);
2121
assert(sizeof(p64)==8);
22-
#endif
22+
/* #endif */
2323

2424
assert(sizeof(void *)==8);
2525
}

regression/cbmc/Visual_Studio_Types2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--winx64
44
^EXIT=0$
55
^SIGNAL=0$
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
KNOWNBUG
2-
test.c
2+
test.i
33
--32 --object-bits 31 --unwind 11 --no-simplify
44
dynamic object too large
55
--
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#include <assert.h>
2-
31
void *malloc(__CPROVER_size_t);
42

53
int main(int argc, char** argv)
64
{
75
char* c=(char*)malloc(10);
86
char* d=c;
97
for(char i=0; i<10; i++, d++);
10-
assert((size_t)d==(size_t)c+10);
8+
__CPROVER_assert((__CPROVER_size_t)d == (__CPROVER_size_t)c + 10, "");
119
}

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// copy of Pointer_Arithmetic12
22

3-
#include <stdint.h>
4-
5-
#include <assert.h>
3+
typedef unsigned int uint32_t;
64

75
uint32_t __stack[32];
86

@@ -100,35 +98,25 @@ int main()
10098
L_0x401_0: esp-=0x14;
10199
L_0x404_0: var15=ebp;
102100
L_0x404_1: var15-=0x4;
103-
#ifdef NONDET
104-
L_0x404_2: *(uint32_t*)(var15)=nondet_uint();
105-
#else
106101
L_0x404_2: *(uint32_t*)(var15)=0xffffffff;
107-
#endif
108102
L_0x40b_0: var16=ebp;
109103
L_0x40b_1: var16-=0x4;
110104
L_0x40b_2: eax=*(uint32_t*)(var16);
111105
L_0x40e_0: *(uint32_t*)(esp)=eax;
112106
L_0x411_0: esp-=4; f__L_0x3c6_0(); esp+=4;
113-
#if 1
114107
uint32_t eax1=eax;
115108
C_0x3ff_0: ebp=esp;
116109
C_0x401_0: esp-=0x14;
117110
C_0x404_0: var15=ebp;
118111
C_0x404_1: var15-=0x4;
119-
#ifdef NONDET
120-
C_0x404_2: *(uint32_t*)(var15)=nondet_uint();
121-
#else
122112
C_0x404_2: *(uint32_t*)(var15)=0xffffffff;
123-
#endif
124113
C_0x40b_0: var16=ebp;
125114
C_0x40b_1: var16-=0x4;
126115
C_0x40b_2: eax=*(uint32_t*)(var16);
127116
C_0x40e_0: *(uint32_t*)(esp)=eax;
128117
C_0x411_0: esp-=4; f__L_0x3c6_0(); esp+=4;
129118
uint32_t eax2=eax;
130-
assert(eax2==eax1);
131-
#endif
119+
__CPROVER_assert(eax2 == eax1, "");
132120
L_0x416_0: esp=ebp;
133121
L_0x416_1: ebp=*(uint32_t*)(esp);
134122
L_0x416_2: esp+=0x4;

regression/cbmc/address_space_size_limit3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
main.i
33
--32 --little-endian --object-bits 25 --pointer-check
44
^EXIT=10$
55
^SIGNAL=0$

0 commit comments

Comments
 (0)