Skip to content

Where clause parsing does not gracefully exit in case of an invalid decl #1096

@secure-sw-dev-bot

Description

@secure-sw-dev-bot

This issue was copied from checkedc/checkedc-clang#1096


If we have code like this:

void f() {
  _Nt_array_ptr<char> p : count(0);
}

The compiler emits an error:

a.c:4: error: automatic variable 'p' with bounds must have initializer
  _Nt_array_ptr<char> p : count(0);

However, if a where clause is attached to this invalid decl:

void f() {
  _Nt_array_ptr<char> p : count(0) _Where 1 == 1;
}

The compiler runs into an infinite loop and emits a lot of these error messages:

a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions