From 96abbcd8f25f03352ff397c2dd442015269722b8 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 27 Mar 2018 16:58:38 +0200 Subject: Arrays should decay to pointers (#65) Arrays should decay to pointers except if they are used as operands of sizeof, _Alignof or as operand of the unary &. The "comma" sequencing operator was missing a "decay" on the type of its second argument. All other operators "decay" their operands correctly. Bug 23299 Bug 23311 --- cparser/Elab.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index e878a2b2..3ef489c1 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1557,7 +1557,7 @@ let elab_expr vararg loc env a = emit_elab ~linkage env loc (Gdecl(sto, id, ty, None)); { edesc = EVar id; etyp = ty },env | _ -> elab env a1 in - let bl = mmap elab env al in + let bl = mmap elab env al in (* Extract type information *) let (res, args, vararg) = match unroll env b1.etyp with @@ -1956,7 +1956,8 @@ let elab_expr vararg loc env a = | BINARY(COMMA, a1, a2) -> let b1,env = elab env a1 in let b2,env = elab env a2 in - { edesc = EBinop (Ocomma, b1, b2, b2.etyp); etyp = b2.etyp },env + let ty2 = pointer_decay env b2.etyp in + { edesc = EBinop (Ocomma, b1, b2, ty2); etyp = ty2 },env (* Elaboration of pre- or post- increment/decrement *) and elab_pre_post_incr_decr op msg a1 = -- cgit