Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • F frama-c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 168
    • Issues 168
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • pub
  • frama-c
  • Issues
  • #1776

Sparecode could eliminate unnecessary if statements

ID0000927: This issue was created automatically from Mantis Issue 927. Further discussion may take place here.


Id Project Category View Due Date Updated
ID0000927 Frama-C Plug-in > sparecode public 2011-08-17 2014-02-12
Reporter djs52 Assigned To Anne Resolution fixed
Priority normal Severity minor Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C Carbon-20110201 Target Version - Fixed in Version Frama-C Nitrogen-20111001

Description :

This arose trying to use the [sparecode] plugin from another plugin, where constant propagation has reduced a conditional to "if (1)". However, a similar case from the command line is:

int main (int x) { //@assert x>5; if (x > 5) { return 3; } else { return 4; } }

frama-c -sparecode-analysis /tmp/test.c

... /* Generated by Frama-C / int main(int x ) { int __retres ; /@ assert (x > 5); */ ; if (x > 5) { __retres = 3; } return (__retres); }

Note that although [sparecode] has figured out that the else branch can be ignored, it has not removed the if condition, which is also redundant by the same reasoning.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking