acwj
acwj copied to clipboard
Segmentation fault on part 18
My test file demo.c are as follow.
int main()
{
int a;
char c;
a = 1;
c = a;
return (1);
}
I run make, then excute command ./compl ./demo.c.
Output displays Segmentation fault.
I guess some bugs in in function binexpr() of file expr.c.
// Ensure the right's type matches the left
right = modify_type(right, left->type, 0);
if (left == NULL) // <- bug
fatal("Incompatible expression in assignment");
correct it if (right == NULL), and then the program run correctly.
I aslo catched this program. I think that is a writing mistake.