Issue 202764
Summary Crash in ASTContext::getTypeInfoImpl with uninitialised C23 auto variable and GNU asm register label
Labels new issue
Assignees
Reporter danieljwait
    ### Summary

Declaring an uninitialised variable with C23's `auto` and GNU's `asm` extension and register label results in a frontend crash when using the `gnu23` language standard. On an assertions-enabled build an assertion failure is seen before the crash.

This crash is present from Clang 18.1.0 to trunk. Clang with `-std=c23` instead of `-std=gnu23`, and GCC, both gracefully rejects this input.

Input generated by fuzzer.

### Revision

```
clang version 23.0.0git (https://github.com/llvm/llvm-project.git dd87edd1f48b02e4a58dbd0a6fdda07c36c4dea8)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
```

### Reduced testcase

```c
auto register i asm("esp");
```

### Reproduction command

```bash
clang -std=gnu23 -fsyntax-only
```

### Observed behaviour

Clang aborts with the following assertion failure:

```
Assertion `!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"' failed.
```

Triggered at:

```
clang/lib/AST/ASTContext.cpp:2542
```

Relevant stack frames:

```
clang::ASTContext::getTypeInfoImpl
clang::ASTContext::getTypeInfo
clang::Sema::CheckAsmLabel
clang::Sema::ActOnVariableDeclarator
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to