kframework/c-semantics

Comma operator in C semantics

Opened this issue · 0 comments

This fails to compile:

int x = (2,3);

The top of the K cell:

toRVal(tv(#token("3","Int"),ut(`SetItem`(`IntegerConstant_C-TYPING-SYNTAX`(.KList)),`int_C-TYPING-SYNTAX`(.KList))))~>
compoundExp(toRVal(checkUse(tv(#token("3","Int"),ut(`SetItem`(`IntegerConstant_C-TYPING-SYNTAX`(.KList)),`int_C-TYPING-SYNTAX`(.KList))))))~>
`reval()_C-COMMON-EXPR-EVAL`(.KList)~>
`#freezerInitializer(_:=_)_C-SYNTAX0_`(nclv(loc(obj(#token("2","Int"),#token("4","Int"),static(#token("\"empty0.ce8e2d306-e039-11e9-94df-f2515646699c\"","String"))),#token("0","Int")),t(quals(`.Set`(.KList)),`.Set`(.KList),`int_C-TYPING-SYNTAX`(.KList))))~>

However, if x is a local variable, everything works:

int main(){int x = (2,3);}