From dcb9f48f51cec5e864565862a700c27df2a1a7e6 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sat, 3 Nov 2012 10:36:15 +0000 Subject: Flocq-based parsing of floating-point literals (Jacques-Henri Jourdan) git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2065 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cparser/Cutil.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cparser/Cutil.ml') diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 4856c01d..d84b9c9b 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -625,7 +625,7 @@ let enum_ikind = IInt let type_of_constant = function | CInt(_, ik, _) -> TInt(ik, []) - | CFloat(_, fk, _) -> TFloat(fk, []) + | CFloat(_, fk) -> TFloat(fk, []) | CStr _ -> TPtr(TInt(IChar, []), []) (* XXX or array? const? *) | CWStr _ -> TPtr(TInt(wchar_ikind, []), []) (* XXX or array? const? *) | CEnum(_, _) -> TInt(IInt, []) @@ -708,10 +708,11 @@ let valid_cast env tfrom tto = let intconst v ik = { edesc = EConst(CInt(v, ik, "")); etyp = TInt(ik, []) } -(* Construct a float constant *) +(* Construct the 0 float constant of double type *) -let floatconst v fk = - { edesc = EConst(CFloat(v, fk, "")); etyp = TFloat(fk, []) } +let floatconst0 = + { edesc = EConst(CFloat({hex=false; intPart="0"; fracPart="0"; exp="0"}, FDouble)); + etyp = TFloat(FDouble, []) } (* Construct the literal "0" with void * type *) -- cgit