gergo- / ldrgen Goto Github PK
View Code? Open in Web Editor NEWLiveness-driven random C code generator
License: GNU General Public License v3.0
Liveness-driven random C code generator
License: GNU General Public License v3.0
The merged PR #3 makes ldrgen
generate a spurious "break" label along each while
statement. Such a label seems to be related to some exit condition/statement for the loop which, however, does not exist.
Snippet of such a generation:
while (i < N) {
v_29 = *(arr + i);
v_19 += ! ((unsigned int)v_27 / (v_29 + 660U));
i ++;
}
while_0_break: ;
This not a dreadful issue, but it would be better not to generate such useless labels (and respective;
statements).
The problem seems to be related to the -simplify-cfg
machinery of Frama-C, which ldrgen
seems to activate in some unclear way.
Indeed, the Frama-C's pretty-printer typically recognizes code patterns like:
while(1) { if (!cond) break; ... }
and turns them into:
while (cond) { ... }
When -simplify-cfg
is activated and has called on a code, the first code pattern is turned into:
while(1) { if (!cond) goto while_0_break; ... } while_0_break: ;
and the pretty-printer goes on with its job but does not remove the label as it would be difficult to do in general.
This seems the most plausible explanation of the issue, at least this is what the senior devs of Frama-C told me, but I haven't found any evident mention of -simplify-cfg
nor programmatic use of it in ldrgen
.
Occasionally we generate code containing an expression inff
which is then rejected by the C compiler when we try to compile the generated function. Presumably some randomly generated floating point constant is an infinity. We should only generate finite constants.
$ make
Ocamlc generate.cmo
File "generate.ml", line 177, characters 31-46:
177 | Cil.mkCast ~force:false ~e:(Cil.zero ~loc) ~newt:typ
^^^^^^^^^^^^^^^
Error: The function applied to this argument has type
Cil_types.exp -> Cil_types.exp
This argument cannot be applied with label ~e
make: *** [/home/yansendao/.opam/default/share/frama-c/Makefile.generic:78: generate.cmo] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.