llvm / llvm/llvm-project

[clang][X86] psABI diagnostics are not emitted when no FunctionDecl is available

Open
#208,087 0 comments 0 reactions 0 assignees View on GitHub
clang clang:diagnostics
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

We have psABI diagnostics implemented but they only work when there is a valid FunctionDecl. We should expand this to also cover cases where no FunctionDecl is available.

For example gcc emits a warning here but clang does not:

```c
typedef short avx256Type __attribute__((vector_size(32)));
typedef void (*fp_arg_t)(avx256Type);

__attribute__((used)) static void call_fp_arg(fp_arg_t fp) {
avx256Type x = (avx256Type){0};
fp(x); // Missing -Wpsabi warning.
}
```

https://godbolt.org/z/6xG9EETqa

For context see discussion in https://github.com/llvm/llvm-project/pull/199091

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown C example with Clang and inspect the existing psABI diagnostic handling, especially how it depends on a FunctionDecl. Use the linked discussion for context. Done means the no-FunctionDecl case emits the expected -Wpsabi warning, with coverage for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.