-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The fix for #1828 also addresses many of the symptoms of #1788, so let's add a test case to ensure that those symptoms remain cured.
- Loading branch information
1 parent
eb05b49
commit 53b5ef0
Showing
5 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CC = clang | ||
CFLAGS = -g -frecord-command-line -O0 | ||
|
||
all: test.bc test.exe | ||
|
||
test.bc: test.c | ||
$(CC) $(CFLAGS) -c -emit-llvm $< -o $@ | ||
|
||
test.o: test.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
test.exe: test.o | ||
$(CC) $(CFLAGS) $< -o $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f test.bc test.exe |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <stdint.h> | ||
|
||
uint32_t mult(uint32_t x) { | ||
return x * 0x85EBCA77U; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This test case ensures that ABC can prove that a C implementation of the | ||
// `mult` function is equivalent to a direct Cryptol implementation of the | ||
// same function. | ||
|
||
let | ||
{{ | ||
cryptol_mult : [32] -> [32] | ||
cryptol_mult x = x * 0x85EBCA77 | ||
}}; | ||
|
||
m <- llvm_load_module "test.bc"; | ||
llvm_mult <- llvm_extract m "mult"; | ||
prove abc {{ \x -> llvm_mult x == cryptol_mult x }}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set -e | ||
|
||
$SAW test.saw |