From 53b5ef0c8f2b5c14d0eeac38c409a3350c15a305 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 9 Mar 2023 10:06:17 -0500 Subject: [PATCH] Add test case for #1788 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. --- intTests/test1788/Makefile | 17 +++++++++++++++++ intTests/test1788/test.bc | Bin 0 -> 2788 bytes intTests/test1788/test.c | 5 +++++ intTests/test1788/test.saw | 13 +++++++++++++ intTests/test1788/test.sh | 3 +++ 5 files changed, 38 insertions(+) create mode 100644 intTests/test1788/Makefile create mode 100644 intTests/test1788/test.bc create mode 100644 intTests/test1788/test.c create mode 100644 intTests/test1788/test.saw create mode 100755 intTests/test1788/test.sh diff --git a/intTests/test1788/Makefile b/intTests/test1788/Makefile new file mode 100644 index 0000000000..1a3bb3f6a4 --- /dev/null +++ b/intTests/test1788/Makefile @@ -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 diff --git a/intTests/test1788/test.bc b/intTests/test1788/test.bc new file mode 100644 index 0000000000000000000000000000000000000000..8d2870d93b7a92c94964b81896792265dac28789 GIT binary patch literal 2788 zcma)8ZA@F&89tY5I1ZR=^P$8f*UoiFBCCz@#U#YUumPqmS(yS^wPji-Y>dHfz}UY2 z!pWvi_cNG(F82%!N5zyDj`|J~5H|8f09MW5J10ZpesC{%(_ zMTrhUhjv26vHJ5J3$o*7DpSh^Dxo+~DzDSZ-X0KDFO_s&sOU_nOtogY`qgq%XR_Nn zr>pO(mQt#Y3nhaK@~gF+_2ne@A!X`Js9(^(kZwFX_4;{kZUN-J#UTX8A=5tj4sP&G zSZ?MiPmRzofN#&-!KYtAp}c5^ zp5_!uU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j!@+@|ClGApy25t<5cl2UYL{~$ILsaQ42?abgdHxszh7`ioyMTx zH;%Xmj3XnVQ9~nd9B_M#McIa7&M@S6I>!8i2FKXwsNFMY7;$@?oZ$q|862F!IqD7= z2p?CpiZhHAM*|L2FBkansudb2v+boSIpS$PC#pVF#7`b- zQl!r3Rf;B=l#(6P?`m%TZSyYE)uwl@{-&?wU_F_>bK~f*j@>ZrYPvCX?bm%j!RJoe z9oJ3^$Ln7d-rI8^T|Gc%b!SeWt`O=SuL>{jIgml`1McBzMHS`nMuy?aIpxh*+W;0* z)|RE*#1=abFJcFQ`<6~q%+sBRH*Cx&y^#LOO#%YtC%w!QqVh+o;vIwYt(W7LO8_dm zEgNqIfTeTfAH&We^gZZnWF3cKYvJmW9dT=R{~e*f@CaFew(pgNbe}eP9EPZi<=)8h z6dDbV1PXC*dmJOdL8mcdZtibBOq?Bz7=}GT2ns}A2n<3N7=qAv8eF7nGWGvIjDc~l zQ)qDY_dnwadIa~d$2rJ>j0i%%yqtR<4Xfi+J5ssP8YOm=+9r&~gS!j&Et=|($NA+hxu`}P)v=E+=@cdC)Gl>RqMmB1LblZG6ji05 z`2jEDeArKLi6PKLp(f4RjO8oWz^J ereSbkxM9! + +uint32_t mult(uint32_t x) { + return x * 0x85EBCA77U; +} diff --git a/intTests/test1788/test.saw b/intTests/test1788/test.saw new file mode 100644 index 0000000000..ceb9626201 --- /dev/null +++ b/intTests/test1788/test.saw @@ -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 }}; diff --git a/intTests/test1788/test.sh b/intTests/test1788/test.sh new file mode 100755 index 0000000000..2315cc233c --- /dev/null +++ b/intTests/test1788/test.sh @@ -0,0 +1,3 @@ +set -e + +$SAW test.saw