llvm / llvm/llvm-project

Clang: accept self variable value assignement, without any warnings or errors

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

Description

when i try

```c
int self = self;
```

it works without problems, and even with

```bash
relunsec@relunsec:~/software/claudes-c-compiler/target/debug$ clang a.c -o a -Wall -Wuninitialized -Wextra
```

those flags, it still compile, accessing to self is **UB**

# Version

```rust
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided C snippet with the clang command and warning flags from the issue, using the stated Ubuntu Clang version. Trace how this self-initialization is handled and compare the diagnostic behavior with the issue's expectation. Done means the case receives an appropriate warning or error without introducing unrelated diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.