acwj icon indicating copy to clipboard operation
acwj copied to clipboard

Segmentation fault on part 18

Open dslu7733 opened this issue 5 years ago • 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.

dslu7733 avatar Jun 03 '20 12:06 dslu7733

I aslo catched this program. I think that is a writing mistake.

alex-xia-xia avatar Sep 16 '20 03:09 alex-xia-xia