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 171
    • Issues 171
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • 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
  • #1550
Closed
Open
Issue created Apr 23, 2009 by Guillaume Melquiond@melquiondDeveloper

Conversion from integer to real

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


Id Project Category View Due Date Updated
ID0000060 Frama-C Kernel public 2009-04-23 2014-02-12
Reporter gmelquio Assigned To virgile Resolution fixed
Priority normal Severity major Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C GIT, precise the release id Target Version - Fixed in Version Frama-C Beryllium-20090601-beta1

Description :

While the documentation says that "there are implicit coercions for numeric types: integer is itself a subtype of type real" and that cast are allowed in logic expressions, neither seem to work.

/*@ ensures 1.0 == 1; */ void f();

/*@ ensures 1.0 == (real)1; */ void g();

When running "frama-c test.c" (revision 5096), I get

File test.c, line 1, characters 19-20: Error during analysis of annotation: invalid cast between real and integer. Use conversion functions instead test.c:1: Warning: Ignoring specification of function f File test.c, line 4, characters 19-26: Error during analysis of annotation: cannot cast to logic type test.c:4: Warning: Ignoring specification of function g

The error message talks about some "conversion functions", but there are no such things in the documentation. The Jessie plugin seems to know about a \real_of_int function, but the CIL front end does not. So how does one convert an integer to a real, if neither implicit nor explicit casts work?

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