From 2f4b36709da7eed73bd9d7119c3d91e101cd331f Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 4 Nov 2013 08:53:55 +0000 Subject: Error for 'switch' on a 64-bit integer argument. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2360 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/C2C.ml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cfrontend') diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index a121678..285797d 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -376,6 +376,11 @@ let supported_return_type env ty = | C.TStruct _ | C.TUnion _ -> false | _ -> true +let is_longlong env ty = + match Cutil.unroll env ty with + | C.TInt((C.ILongLong|C.IULongLong), _) -> true + | _ -> false + (** Floating point constants *) let z_of_str hex str fst = @@ -704,6 +709,8 @@ let rec convertStmt ploc env s = | C.Scontinue -> Scontinue | C.Sswitch(e, s1) -> + if is_longlong env e.etyp then + unsupported "'switch' on an argument of type 'long long'"; let (init, cases) = groupSwitch (flattenSwitch s1) in if cases = [] then unsupported "ill-formed 'switch' statement"; -- cgit v1.2.3