Fix incorrect val.i64 check

This commit is contained in:
Niels Dossche 2023-02-12 14:11:31 +01:00
parent 6b8a33d726
commit 9d3354e89e
2 changed files with 2 additions and 2 deletions

2
ir.g
View File

@ -269,7 +269,7 @@ val(ir_parser_ctx *p, uint8_t op, uint32_t n, ir_ref *ref):
{*ref = ir_strl(p->ctx, str, len);}
| DECNUMBER(IR_I32, &val)
{if (kind != IR_OPND_NUM && kind != IR_OPND_PROB) yy_error("unexpected number");}
{if (val.i64 < 0 && val.i64 >= 0x7ffffff) yy_error("number out of range");}
{if (val.i64 < 0 || val.i64 > 0x7fffffff) yy_error("number out of range");}
{*ref = val.u64;}
| "null"
{*ref = IR_UNUSED;}

View File

@ -893,7 +893,7 @@ static int parse_val(int sym, ir_parser_ctx *p, uint8_t op, uint32_t n, ir_ref *
} else if (sym == YY_DECNUMBER) {
sym = parse_DECNUMBER(sym, IR_I32, &val);
if (kind != IR_OPND_NUM && kind != IR_OPND_PROB) yy_error("unexpected number");
if (val.i64 < 0 && val.i64 >= 0x7ffffff) yy_error("number out of range");
if (val.i64 < 0 || val.i64 > 0x7fffffff) yy_error("number out of range");
*ref = val.u64;
} else if (sym == YY_NULL) {
sym = get_sym();