llvm / llvm/llvm-project

static float f = 0.f / 0.f; cannot be compiled

Open
#161,806 8 comments 0 reactions 0 assignees View on GitHub
c23 clang:frontend confirmed regression:19
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This program will not compile.

```c
int main(void){
if(1){
static float f = 0.f / 0.f;/* cannot compile this constant l-value expression yet */
}
return 0;
}
```

I believe that C99 introduced this feature along with IEEE-754 floating-point.
It is one way to create a NAN.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by compiling the minimal C reproducer and checking the diagnostic against C99 constant-expression requirements, then trace handling of static initializers and floating-point constant expressions. Done means the example is accepted as intended and has regression coverage.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.