Skip to content

GitLab

  • Menu
Projects Groups 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
    • Contributors
    • Graph
    • Compare
  • Issues 209
    • Issues 209
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • pub
  • frama-c
  • Issues
  • #235

Closed
Open
Created Feb 03, 2018 by mantis-gitlab-migration@mantis-gitlab-migration

RTE assertion for signed right shift is wrong

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


Id Project Category View Due Date Updated
ID0002354 Frama-C Plug-in > RTE public 2018-02-03 2018-11-30
Reporter xleroy Assigned To signoles Resolution fixed
Priority normal Severity minor Reproducibility have not tried
Platform - OS - OS Version -
Product Version Frama-C 16-Sulfur Target Version - Fixed in Version Frama-C 18-Argon

Description :

Consider:

/*@ ensures \result == arg >> 2; */

int toto(int arg) { return arg >> 2; }

"frama-c -wp -wp-rte" fails to verify this rather tautological spec because the RTE pass inserts the assertion

/*@ assert rte: shift: 0 ≤ arg; */

I think this is an incorrect reading of the ISO C 90 and C 99 specs: right-shift of a signed integer expression that has a negative value is implementation-defined, but is not an undefined behavior. (See ISO C 99 section 6.5.7 item 5.)

I would suggest that WP and RTE accept the spec above, so that I can actually reason about the right shift, probably by adding axioms specifying how right shifts of negative numbers work on the platforms I am (and everyone is) interested in.

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