Skip to content
Snippets Groups Projects
Commit 1ebccda6 authored by xleroy's avatar xleroy
Browse files

Problem with const enum initializers

git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1146 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
parent 9534f739
No related branches found
No related tags found
No related merge requests found
......@@ -158,6 +158,8 @@ and eval_cast ty v =
| TInt(ik, _), CInt64(v, _, _) -> mkint64 ik v
| TInt(ik, _), CReal(v, _, _) ->
if ik = IULongLong then raise NotConst else mkint64 ik (Int64.of_float v)
| TEnum _, CInt64(v, _, _) -> mkint64 IInt v
| TEnum _, CReal(v, _, _) -> mkint64 IInt (Int64.of_float v)
| TFloat(fk, _), CReal(v, _, _) -> mkfloat fk v
| TFloat(fk, _), CInt64(v, ik, _) ->
if ik = IULongLong then raise NotConst else mkfloat fk (Int64.to_float v)
......
No preview for this file type
......@@ -27,6 +27,9 @@ float x11 = 1 + 1 / 3.14159;
double x12 = 1 / 3.14159 + 1;
typedef enum { AAA , BBB } MyEnum;
const MyEnum x13[2] = { AAA, BBB };
int main(int argc, char ** argv)
{
......@@ -50,6 +53,7 @@ int main(int argc, char ** argv)
x10.u.y, x10.u.z, x10.v);
printf("x11 = %.10f\n", x11);
printf("x12 = %.10f\n", x12);
printf("x13 = { %d, %d }\n", x13[0], x13[1]);
return 0;
}
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