llvm / llvm/llvm-project

Clang Crash in LValue/ExprConstant on Malformed Array Initializer (trunk + assertion)

Open
#183,877 2 comments 0 reactions 0 assignees View on GitHub
clang:frontend crash-on-invalid generated by fuzzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Overview
- crash on invalid
- generated by fuzzer
- crashes both trunk and assertion builds

## Code
```c
arr[;
arr[];
void func(){
int* ptr = arr-1;
}
```

## CompilerExplorer
https://godbolt.org/z/fq5scf5d1

## Notes
- Thought this was related to #170072, but that does not crash the non-assertion trunk build, unlike this code.
- Here is the godbolt for that issue: https://godbolt.org/z/a1bnMahrn

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the malformed C initializer in the issue using the linked Compiler Explorer case, comparing trunk and assertion builds. Start by tracing the Clang LValue/ExprConstant path named in the title and inspect the related issue #170072 for context. Done means the reproducer no longer crashes in either build, with regression coverage for this input.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.