summaryrefslogtreecommitdiff
path: root/cfrontend
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-11-04 08:53:55 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-11-04 08:53:55 +0000
commit2f4b36709da7eed73bd9d7119c3d91e101cd331f (patch)
tree2c1c844f7cd07c94d0d8f6182c91da6281b7ea91 /cfrontend
parentd915084693805e58aadb7e46ae9a63a1a51e8c47 (diff)
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
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml7
1 files changed, 7 insertions, 0 deletions
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";