Skip to content

Instantly share code, notes, and snippets.

View smcc's full-sized avatar

Stephen McCamant smcc

View GitHub Profile
@smcc
smcc / gettime64.c
Created October 28, 2016 03:58
Test program for some Unix time syscalls
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
int main(int argc, char **argv) {
struct timespec ts;
@smcc
smcc / stp-even-eqn-assert.c
Created February 22, 2015 23:34
Small C program using the STP C interface that triggers an assertion in stp::BVSolver::CheckEvenEqn
#include "c_interface.h"
void test(void) {
VC vc = vc_createValidityChecker();
vc_setInterfaceFlags(vc, (ifaceflag_t)0, 0);
vc_push(vc);
Type ty_bv8 = vc_bvType(vc, 8);
Type ty_bv16 = vc_bvType(vc, 16);
Type ty_bv32 = vc_bvType(vc, 32);
@smcc
smcc / cms2-stp-bad-min2.smt2
Created October 4, 2014 23:28
STP SMTLIB2 input causing crash in CryptoMiniSAT2
(set-logic QF_BV)
(declare-fun _substvar_63535_ () Bool)
(declare-fun _substvar_11241_ () (_ BitVec 8))
(declare-fun _substvar_11228_ () (_ BitVec 8))
(declare-fun _substvar_11223_ () (_ BitVec 8))
(declare-fun _substvar_58110_ () (_ BitVec 32))
(declare-fun _substvar_11243_ () (_ BitVec 8))
(declare-fun _substvar_11242_ () (_ BitVec 8))
(declare-fun _substvar_74320_ () Bool)
(declare-fun _substvar_61240_ () (_ BitVec 32))
% Trimmed-down example that triggers failures in many different
% STP versions because it causes STP to think about dividing
% by zero.
y : BV(8);
% Should be equivalent to "t4 : BV(8) = 0h01":
t4 : BV(8) = BVPLUS(8, y, BVUMINUS(y), 0h01);
% Should be invalid. Definitely by y = 0h01, but potentially