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
  • #1817

crash

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


Id Project Category View Due Date Updated
ID0001495 Frama-C Kernel > ACSL implementation public 2013-10-01 2014-02-05
Reporter alessioiotti Assigned To virgile Resolution open
Priority normal Severity minor Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C Fluorine-20130601 Target Version - Fixed in Version -

Description :

The full backtrace is: Raised at file "hashtbl.ml", line 254, characters 18-27 Called from file "hashtbl.ml", line 262, characters 22-38

The program raise an unexpected error trying to prove an ensures clause with behavior using a logic function.

The code is the following:

/*@
  @ predicate IsValidRange(int* a, integer n) =
  @   (0 <= n) && \valid(a+(0.. n-1));
  @
  @
  @ predicate IsEqual{A, B}(int* a, int* b, integer n) =
  @   \forall integer i; 0 <= i < n ==> \at(a[i], A) == \at(b[i], B);
  @
  @ logic integer MinIndex(int* a, int* b, integer starting_index, integer count) =
  @   ((count <= 0 || starting_index >= count) ? -1 : 
  @     (starting_index == count)) ? -1 :
  @        (a[starting_index] != b[starting_index]) ? starting_index : MinIndex(a, b, (starting_index + 1), count);       
*/
 
/*@ requires \valid(a+(0..n-1)) && \valid(b+(0..n-1)) && (n >= 0);
  @ assigns \nothing;
  @ behavior equal:
  @   assumes IsEqual{Here, Here}(a, b, n);
  @   ensures \result == n;
  @ behavior not_equal:
  @   assumes !IsEqual{Here, Here}(a, b, n);
  @   ensures \result == MinIndex(a, b, 0, n);
  @ complete behaviors;
  @ disjoint behaviors;
*/
int mismatch(const int* a, const int* b, int n) {
    /*@ loop assigns i;     	    
      @ loop invariant (0 <= i <= n) && IsEqual{Here, Here}(a, b, i);
      @ loop variant n - i;
    */
  for (int i = 0; i < n; i++)
    if (a[i] != b[i])
      return i;
  
  return n;
}
Edited Sep 28, 2022 by Allan Blanchard
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking