Skip to content

Commit

Permalink
Fix for cdata vs. non-cdata arithmetics/comparisons.
Browse files Browse the repository at this point in the history
Thanks to Vyacheslav Egorov.
  • Loading branch information
Mike Pall committed Jul 17, 2016
1 parent 1914de7 commit b74ddaf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lj_crecord.c
Expand Up @@ -1205,7 +1205,7 @@ void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd)

static TRef crec_arith_int64(jit_State *J, TRef *sp, CType **s, MMS mm)
{
if (ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
if (sp[0] && sp[1] && ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
IRType dt;
CTypeID id;
TRef tr;
Expand Down Expand Up @@ -1263,6 +1263,7 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm)
{
CTState *cts = ctype_ctsG(J2G(J));
CType *ctp = s[0];
if (!(sp[0] && sp[1])) return 0;
if (ctype_isptr(ctp->info) || ctype_isrefarray(ctp->info)) {
if ((mm == MM_sub || mm == MM_eq || mm == MM_lt || mm == MM_le) &&
(ctype_isptr(s[1]->info) || ctype_isrefarray(s[1]->info))) {
Expand Down

0 comments on commit b74ddaf

Please sign in to comment.