Segmentation fault on part 18
Author: dslu7733Created Jun 3, 2020Updated Aug 27, 2024
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.
Source: DoctorWkt/acwj