DoctorWkt/acwj

Segmentation fault on part 18

dslu7733 opened this issue · 2 comments

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.

The same issue shows up in 18..16, fixed (as suggested) in 27. The attached git patch (renamed as GH doesn't like .patch) applies the fix to the missing files.
0001-Fix-issue-26-in-18.26.txt