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

BlockDecl doesn't get invalidated when it has invalid parameter decls #64005

Closed
hokein opened this issue Jul 21, 2023 · 3 comments
Closed

BlockDecl doesn't get invalidated when it has invalid parameter decls #64005

hokein opened this issue Jul 21, 2023 · 3 comments
Labels
bug Indicates an unexpected problem or unintended behavior clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party

Comments

@hokein
Copy link
Collaborator

hokein commented Jul 21, 2023

// clang -cc1 -ast-dump -fblocks /tmp/t.c
int (^a)(int, int) = ^(int, undefine b) {
   return 1;
};

The BlockDecl AST node looks like below:

-BlockDecl 0x5608ac620da0 <line:4:22, line:6:1> line:4:22
|     |-ParmVarDecl 0x5608ac620e38 <col:24> col:27 'int'
|     |-ParmVarDecl 0x5608ac620ed0 <col:29, col:38> col:38 invalid b 'int'
|     |-CompoundStmt 0x5608ac620fe8 <col:41, line:6:1>
|     | `-ReturnStmt 0x5608ac620fd8 <line:5:4, col:11>
|     |   `-IntegerLiteral 0x5608ac620fb8 <col:11> 'int' 1
|     `-ParmVarDecl 0x5608ac620ed0 <line:4:29, col:38> col:38 invalid b 'int'

two issues:

    1. the invalid bit of BlockDecl is not set, we should set it because of its invalid ParmDecl
    1. The ast-dumper seems to emit a duplicated ParmVarDecl for b
@hokein hokein added bug Indicates an unexpected problem or unintended behavior clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 21, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 21, 2023

@llvm/issue-subscribers-bug

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 21, 2023

@llvm/issue-subscribers-clang-frontend

@AaronBallman AaronBallman added the confirmed Verified by a second party label Jul 21, 2023
@danix800
Copy link
Member

danix800 commented Jul 21, 2023

Fixes proposed:

danix800 added a commit that referenced this issue Jul 24, 2023
BlockDecl should be invalidated because of its invalid ParmVarDecl.

Fixes #1 of #64005

Differential Revision: https://reviews.llvm.org/D155984
veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue Sep 7, 2024
BlockDecl should be invalidated because of its invalid ParmVarDecl.

Fixes #1 of llvm/llvm-project#64005

Differential Revision: https://reviews.llvm.org/D155984
veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue Sep 7, 2024
ParmVarDecl of BlockDecl is unnecessarily dumped twice.
Remove this duplication as other FunctionDecls.

Fixes llvm/llvm-project#64005 (CTSRD-CHERI#2)

Differential Revision: https://reviews.llvm.org/D155985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party
Projects
None yet
Development

No branches or pull requests

4 participants