Do type promotion for short

fold_constants used to do this when it was overly aggressive. Fixes the
ICE when accessing an array in a struct via a pointer.
This commit is contained in:
Bill Currie 2019-06-09 22:26:57 +09:00
parent 227ac46ffe
commit 439cd15620

View file

@ -269,22 +269,22 @@ static expr_type_t integer_uinteger[] = {
};
static expr_type_t integer_short[] = {
{'+', &type_integer},
{'-', &type_integer},
{'*', &type_integer},
{'/', &type_integer},
{'&', &type_integer},
{'|', &type_integer},
{'^', &type_integer},
{'%', &type_integer},
{SHL, &type_integer},
{SHR, &type_integer},
{EQ, &type_integer},
{NE, &type_integer},
{LE, &type_integer},
{GE, &type_integer},
{LT, &type_integer},
{GT, &type_integer},
{'+', &type_integer, 0, &type_integer},
{'-', &type_integer, 0, &type_integer},
{'*', &type_integer, 0, &type_integer},
{'/', &type_integer, 0, &type_integer},
{'&', &type_integer, 0, &type_integer},
{'|', &type_integer, 0, &type_integer},
{'^', &type_integer, 0, &type_integer},
{'%', &type_integer, 0, &type_integer},
{SHL, &type_integer, 0, &type_integer},
{SHR, &type_integer, 0, &type_integer},
{EQ, &type_integer, 0, &type_integer},
{NE, &type_integer, 0, &type_integer},
{LE, &type_integer, 0, &type_integer},
{GE, &type_integer, 0, &type_integer},
{LT, &type_integer, 0, &type_integer},
{GT, &type_integer, 0, &type_integer},
{0, 0}
};
@ -340,42 +340,42 @@ static expr_type_t uinteger_uinteger[] = {
#define short_quat integer_quat
static expr_type_t short_integer[] = {
{'+', &type_integer},
{'-', &type_integer},
{'*', &type_integer},
{'/', &type_integer},
{'&', &type_integer},
{'|', &type_integer},
{'^', &type_integer},
{'%', &type_integer},
{'+', &type_integer, &type_integer, 0},
{'-', &type_integer, &type_integer, 0},
{'*', &type_integer, &type_integer, 0},
{'/', &type_integer, &type_integer, 0},
{'&', &type_integer, &type_integer, 0},
{'|', &type_integer, &type_integer, 0},
{'^', &type_integer, &type_integer, 0},
{'%', &type_integer, &type_integer, 0},
{SHL, &type_short},
{SHR, &type_short},
{EQ, &type_integer},
{NE, &type_integer},
{LE, &type_integer},
{GE, &type_integer},
{LT, &type_integer},
{GT, &type_integer},
{EQ, &type_integer, &type_integer, 0},
{NE, &type_integer, &type_integer, 0},
{LE, &type_integer, &type_integer, 0},
{GE, &type_integer, &type_integer, 0},
{LT, &type_integer, &type_integer, 0},
{GT, &type_integer, &type_integer, 0},
{0, 0}
};
static expr_type_t short_uinteger[] = {
{'+', &type_uinteger},
{'-', &type_uinteger},
{'*', &type_uinteger},
{'/', &type_uinteger},
{'&', &type_uinteger},
{'|', &type_uinteger},
{'^', &type_uinteger},
{'%', &type_uinteger},
{'+', &type_uinteger, &type_uinteger, 0},
{'-', &type_uinteger, &type_uinteger, 0},
{'*', &type_uinteger, &type_uinteger, 0},
{'/', &type_uinteger, &type_uinteger, 0},
{'&', &type_uinteger, &type_uinteger, 0},
{'|', &type_uinteger, &type_uinteger, 0},
{'^', &type_uinteger, &type_uinteger, 0},
{'%', &type_uinteger, &type_uinteger, 0},
{SHL, &type_short},
{SHR, &type_short},
{EQ, &type_integer},
{NE, &type_integer},
{LE, &type_integer},
{GE, &type_integer},
{LT, &type_integer},
{GT, &type_integer},
{EQ, &type_integer, &type_uinteger, 0},
{NE, &type_integer, &type_uinteger, 0},
{LE, &type_integer, &type_uinteger, 0},
{GE, &type_integer, &type_uinteger, 0},
{LT, &type_integer, &type_uinteger, 0},
{GT, &type_integer, &type_uinteger, 0},
{0, 0}
};