Skip to content

Commit

Permalink
Preserve const in function parameters
Browse files Browse the repository at this point in the history
Thanks to Oliver Schwahn for the report.
  • Loading branch information
kerneis committed Feb 17, 2012
1 parent 16ef41d commit dd8da77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/frontc/cabs2cil.ml
Expand Up @@ -2559,6 +2559,8 @@ and makeVarInfoCabs
vtype
in
let vi = makeVarinfo isglobal n t in
(* makeVarinfo removes "const" even for formals, please respect my choices! *)
vi.vtype <- t;
vi.vstorage <- sto;
vi.vattr <- nattr;
vi.vdecl <- ldecl;
Expand Down Expand Up @@ -5781,6 +5783,8 @@ and doDecl (isglobal: bool) : A.definition -> chunk = function
(* sfg: extract locations for the formals from dt *)
let doFormal (loc : location) (fn, ft, fa) =
let f = makeVarinfo false fn ft in
(* makeVarinfo removes const qualifier even on formals *)
f.vtype <- ft;
(f.vdecl <- loc;
f.vattr <- fa;
alphaConvertVarAndAddToEnv true f)
Expand Down

0 comments on commit dd8da77

Please sign in to comment.