[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing tests/spec/bsearch.c (with preprocessing)
tests/spec/bsearch.c:17:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
/* Generated by Frama-C */
/*@ lemma mean_1: ∀ ℤ x, ℤ y; x ≤ y ⇒ x ≤ (x+y)/2 ≤ y;
 */
/*@
predicate sorted{L}(int t[], ℤ n) =
  ∀ ℤ i, ℤ j; 0 ≤ i ≤ j ≤ n ⇒ t[i] ≤ t[j];
 */
/*@ requires n ≥ 0 ∧ \valid(t+(0 .. n-1)) ∧ sorted((int [])t, n-1);
    
    behavior search_success:
      ensures \result ≥ 0 ⇒ *(\old(t)+\result) ≡ \old(v);
    
    behavior search_failure:
      ensures
        \result < 0 ⇒
        (∀ ℤ k; 0 ≤ k < \old(n) ⇒ *(\old(t)+k) ≢ \old(v));
 */
int bsearch(int *t, int n, int v)
{
  int __retres;
  int l;
  int u;
  l = 0;
  u = n - 1;
  /*@ loop invariant
        0 ≤ l ∧ u ≤ n-1 ∧
        (∀ int k; 0 ≤ k < n ⇒ *(t+k) ≡ v ⇒ l ≤ k ≤ u);
      loop variant u-l;
  */
  while (l <= u) {
    int m;
    m = (l + u) / 2;
    if (*(t + m) < v) l = m + 1;
    else 
      if (*(t + m) > v) u = m - 1;
      else {
        __retres = m;
        goto return_label;
      }
  }
  __retres = -1;
  return_label: return __retres;
}


