Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Problem with int and integer in terms


  • Subject: [Frama-c-discuss] Problem with int and integer in terms
  • From: hollas at informatik.htw-dresden.de (Boris Hollas)
  • Date: Thu, 02 Aug 2012 09:53:44 +0200

Hello,

I have the following problem: I hash a term, but I can't find it later 
in the hashtable. I was able to narrow the problem down to the following:

In an assignment
int t = ...;
the lval t has type int, whereas an expression
t-1
has type integer. To construct a term of t, I use the function 
term_of_lval below. This should produce a term of type integer, but it 
doesn't. Instead, the result is a term of type int. Since the cast flag 
in Logic_utils.lval_to_term_lval is false, I'd have expected that int is 
cast to integer. What is wrong here?

-Boris


let term_of_lval x =
   Self.feedback "term_of_lval: input lval %a\n" Cil.d_lval x;
   let xtl = Logic_utils.lval_to_term_lval false x in
   let t = Logic_const.term (TLval xtl) (Cil.typeOfTermLval xtl) in
   Self.feedback "output has type %a\n" Cil.d_logic_type t.term_type;
   t