Skip to content
Snippets Groups Projects
Commit b876bf4e authored by David Bühler's avatar David Bühler
Browse files

Merge branch 'fix/kernel/const-temporary-variable' into 'master'

[kernel] Cabs2cil: do not create const temporary variables.

Closes #966

See merge request frama-c/frama-c!2885
parents 53ed013b a1210628
No related branches found
No related tags found
No related merge requests found
......@@ -1208,6 +1208,7 @@ let get_temp_name ghost () =
(* Create a new temporary variable *)
let newTempVar ~ghost loc descr (descrpure:bool) typ =
let t' = (!typeForInsertedVar) typ in
let t' = Cil.typeRemoveAttributes ["const"] t' in
let name = get_temp_name ghost () in
let vi = makeVarinfo ~ghost ~temp:true ~loc false false name t' in
vi.vdescr <- Some descr;
......
/*run.config
OPT: -no-autoload-plugins -load-module eva,scope -eva -eva-verbose 0
*/
unsigned id(unsigned x) { return x; }
void main() {
unsigned const r = id(1 > 2 ? 1 : 2);
//@ assert written_r: r == 2;
}
[kernel] Parsing tests/syntax/local-init-const.i (no preprocessing)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment