Closed monniaux closed 1 year ago
The problem is in C2C.ml, function convertExpr
:
| C.ECall({edesc = C.EVar {name = "__builtin_va_end"}}, _) ->
Ecast (ezero, Tvoid)
Arguments to va_end
(with possible side effects) are ignored and the whole expression replaced with zero.
Potential fix:
| C.ECall({edesc = C.EVar {name = "__builtin_va_end"}}, [arg]) ->
Ecast (convertExpr env arg, Tvoid)
reduced version of gcc test
va-arg-21.c
It seems to me that this program should not abort. Examination of the RTL shows that for some reason the pointer
d
is incremented only once.This program is equivalent to the following one, which does not abort: