\myheading{Simple expression evaluator (calculator)}

I has been looking for simple expression evaluator (calculator in other words) which takes expression like ``2+2'' on input and gives answer.
I've found one at \url{http://stackoverflow.com/a/13895198}.

\url{\RepoURL/\CURPATH/calc.c}

I reworked it by commenting (f)printf() calls.
Not needed anyway.

KLEE found two expression strings which leads to division error:

\begin{lstlisting}
% clang -emit-llvm -c -g -O0 -Xclang -disable-O0-optnone -I /tmp/klee_src/include/klee/ calc.c

% time klee --libc=uclibc --optimize calc.bc

...

KLEE: ERROR: calc.c:235: divide by zero
KLEE: NOTE: now ignoring this error at this location
KLEE: ERROR: calc.c:239: divide by zero
KLEE: NOTE: now ignoring this error at this location

(I had to interrupt it...)

KLEE: ctrl-c detected, requesting interpreter to halt.
KLEE: halting execution, dumping remaining states

KLEE: done: total instructions = 1629596851
KLEE: done: completed paths = 216
KLEE: done: partially completed paths = 8
KLEE: done: generated tests = 224

real    78m36.891s
user    78m22.369s
...

% ls klee-last | grep err
test000139.div.err
test000158.div.err

% ktest-tool klee-last/test000139.ktest | grep data
object 0: data: b'5/0\x00'

% ktest-tool klee-last/test000158.ktest | grep data
object 0: data: b'5%0\x00'
\end{lstlisting}

Maybe this is not an impressive result, nevertheless,
it's yet another reminder that division and remainder operations must be
wrapped somehow in production code to avoid possible crash.

