From 92ffa31ffc6d7a82d1949b86f0585f149c7615d8 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 25 Aug 2016 09:53:48 +0200 Subject: Test for illegal first argument in __builtin_debug. The test is extended for integer constants smaller than 0. Also the default constant used for the error is no longer 0 since this is not a positive number. Bug 19629 --- cfrontend/C2C.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cfrontend/C2C.ml') diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index decbf58b..07de331e 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -758,8 +758,12 @@ let rec convertExpr env e = | C.ECall({edesc = C.EVar {name = "__builtin_debug"}}, args) -> let (kind, args1) = match args with - | {edesc = C.EConst(CInt(n,_,_))} :: args1 -> (n, args1) - | _ -> error "ill_formed __builtin_debug"; (0L, args) in + | {edesc = C.EConst(CInt(n,_,_))} :: args1 -> + if n <= 0L then begin + error "ill_formed __builtin_debug"; (1L,args1) + end else + (n, args1) + | _ -> error "ill_formed __builtin_debug"; (1L, args) in let (text, args2) = match args1 with | {edesc = C.EConst(CStr(txt))} :: args2 -> (txt, args2) -- cgit