aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-03 10:36:15 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-03 10:36:15 +0000
commitdcb9f48f51cec5e864565862a700c27df2a1a7e6 (patch)
treeb453b51b7406d3b1cf7191729637446a23ffc92c /cparser/Cutil.ml
parentbd93aa7ef9c19a4def8aa64c32faeb04ab2607e9 (diff)
downloadcompcert-kvx-dcb9f48f51cec5e864565862a700c27df2a1a7e6.tar.gz
compcert-kvx-dcb9f48f51cec5e864565862a700c27df2a1a7e6.zip
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
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml9
1 files changed, 5 insertions, 4 deletions
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 *)