diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-25 09:53:48 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-25 09:53:48 +0200 |
commit | 92ffa31ffc6d7a82d1949b86f0585f149c7615d8 (patch) | |
tree | a67c92c4ccabfaa90d882b3db5b36945beb8c822 /cfrontend | |
parent | 0a7288fb65ebaed329e06c1fd14aef83e8defcda (diff) | |
download | compcert-92ffa31ffc6d7a82d1949b86f0585f149c7615d8.tar.gz compcert-92ffa31ffc6d7a82d1949b86f0585f149c7615d8.zip |
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
Diffstat (limited to 'cfrontend')
-rw-r--r-- | cfrontend/C2C.ml | 8 |
1 files changed, 6 insertions, 2 deletions
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) |