rui314 / 8cc

A Small C Compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed assertion.

andrewchambers opened this issue · comments

Using creduce to find bugs in 8cc. First one.

short a;
void fn1() { -a; }

-> 8cc: parse.c:525: usual_arith_conv: Assertion `is_inttype(t) && t->size >= type_int->size' failed.

I think it is unary - not promoting its value with conv, unary minus is done as a binop('-',0,x); where the 0 is the same type as x. This means it attempts to promote x to type short, which fails the assertion above.

addressed in #30. handle it there.