GithubHelp home page GithubHelp logo

ldrgen's People

Contributors

gergo- avatar lambdaxdotx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ldrgen's Issues

Spurious break labels generated along with while statements

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).

Hypothesis on the problem

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.

Sporadic generation of undeclared identifier "inff"

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 error with frama-c 23.1 (Vanadium)

$ 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.