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

check for typedef specifier/attribute not strict enough #142

Open
samkho opened this issue Aug 23, 2024 · 0 comments
Open

check for typedef specifier/attribute not strict enough #142

samkho opened this issue Aug 23, 2024 · 0 comments

Comments

@samkho
Copy link

samkho commented Aug 23, 2024

The comment and code for line 423 of parse.c do not match. It seems the comment describes the correct behavior.

chibicc/parse.c

Line 423 in 90d1f7f

attr->is_static + attr->is_extern + attr->is_inline + attr->is_tls > 1)

 
The comparison "> 1" should instead be ">= 1" or "> 0" or "!= 0" . Also, it would be clearer if the four attr->is_.... bools are OR'd together instead of added.

  1. gcc, clang, and chibicc all flag the following as illegal:

static inline typedef struct
{
int x;
int y;
} Point;

  1. BUT chibicc allows the following which both gcc and clang flag as illegal:

static typedef struct
{
int x;
int y;
} Point;

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

1 participant