Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on part 18 #26

Open
dslu7733 opened this issue Jun 3, 2020 · 2 comments
Open

Segmentation fault on part 18 #26

dslu7733 opened this issue Jun 3, 2020 · 2 comments

Comments

@dslu7733
Copy link

dslu7733 commented Jun 3, 2020

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.

@alex-xia-xia
Copy link

alex-xia-xia commented Sep 16, 2020

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

@vonbrand
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants