Skip to content

Commit 126cfff

Browse files
committed
Add two tests (marked KNOWNBUG for now) as documentation for lack of support for byte operations on pointers.
In particular the tests regard `byte_extract_little_endian` and `byte_update_little_endian` expressions.
1 parent f803197 commit 126cfff

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint32_t input;
7+
uint32_t original = input;
8+
uint8_t *ptr = (uint8_t *)(&input);
9+
assert(*ptr == 0); // falsifiable
10+
*ptr = ~(*ptr);
11+
assert(input != original); // valid
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
KNOWNBUG
2+
byte_extract_issue.c
3+
--trace
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
--
7+
Reached unimplemented Generation of SMT formula for byte extract expression: byte_extract_little_endian
8+
--
9+
This test is here to document our lack of support for byte_extract_little_endian
10+
in the pointers support for the new SMT backend.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint32_t x = 0;
7+
uint8_t *ptr = (uint8_t *)(&x);
8+
int offset;
9+
__CPROVER_assume(offset >= 0 && offset < 4);
10+
*(ptr + offset) = 1;
11+
assert(x != 256);
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
KNOWNBUG
2+
byte_update_issue.c
3+
--trace
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
--
7+
Reached unimplemented Generation of SMT formula for byte extract expression: byte_update_little_endian
8+
--
9+
This test is here to document our lack of support for byte_update_little_endian
10+
in the pointers support for the new SMT backend.

0 commit comments

Comments
 (0)