<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/118058>118058</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang-20 : Assertion `!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          iamanonymouscs
      </td>
    </tr>
</table>

<pre>
    ### Description
I encountered a crash in Clang-20 when compiling the following code snippet:

```c
int main() {
 double x = 37;
  // clang doesn't accept that
  __auto_type restrict xr = &x;
  restrict __auto_type rx = &x;
  __auto_type _Atomic xa = x;
 _Atomic __auto_type ax = x;
}
```

```sh
$ clang -v
Ubuntu clang version 20.0.0 (++20241128033836+45b567be8d0d-1~exp1~20241128153857.2079)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-20/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
```

###  Command

The compilation command used was:
```sh
clang  -fno-rtlib-add-rpath  -fno-ident -O3 -ffast-math -Wall -Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address test.c
```

### Error Message
```sh
<source>:4:24: warning: unused variable 'xr' [-Wunused-variable]
    4 |   __auto_type restrict xr = &x;
 |                        ^~
<source>:5:24: warning: unused variable 'rx' [-Wunused-variable]
    5 |   restrict __auto_type rx = &x;
      | ^~
<source>:6:23: warning: unused variable 'xa' [-Wunused-variable]
    6 |   __auto_type _Atomic xa = x;
      | ^~
<source>:7:24: warning: unused variable 'ax' [-Wunused-variable]
    7 |    _Atomic __auto_type ax = x;
      | ^~
clang: /root/llvm-project/clang/lib/AST/ASTContext.cpp:2394: clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const: Assertion `!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fno-rtlib-add-rpath -fno-ident -O3 -ffast-math -Wall -Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address <source>
1.      <eof> parser at end of file
2.      <source>:1:5: LLVM IR generation of declaration 'main'
3.      <source>:1:5: Generating code for declaration 'main'
 #0 0x0000000003c02b58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c02b58)
 #1 0x0000000003c0085c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c0085c)
 #2 0x0000000003b4df48 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f3141042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f31410969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f3141042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f31410287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f314102871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f3141039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000073aa31d clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73aa31d)
#10 0x00000000073934e7 clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73934e7)
#11 0x00000000073aa404 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73aa404)
#12 0x00000000073934e7 clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73934e7)
#13 0x00000000073abfcb clang::ASTContext::getPreferredTypeAlign(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73abfcb)
#14 0x00000000073acacb clang::ASTContext::getDeclAlign(clang::Decl const*, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x73acacb)
#15 0x00000000043b93d1 clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43b93d1)
#16 0x00000000043bfdbb clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#17 0x00000000043c0016 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43c0016)
#18 0x0000000003f5d7f7 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f5d7f7)
#19 0x0000000003f74749 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f74749)
#20 0x0000000003f6c3b5 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f6c3b5)
#21 0x0000000003f74164 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f74164)
#22 0x0000000003fdd1b4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fdd1b4)
#23 0x0000000003ff017c clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ff017c)
#24 0x0000000004057d4a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4057d4a)
#25 0x0000000004052fb5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4052fb5)
#26 0x000000000405339b clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x405339b)
#27 0x000000000405db73 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#28 0x000000000458bd06 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#29 0x000000000457ca38 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x457ca38)
#30 0x00000000065342f4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65342f4)
#31 0x00000000045898b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45898b8)
#32 0x0000000004843f99 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4843f99)
#33 0x00000000047c3eae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47c3eae)
#34 0x000000000492efae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x492efae)
#35 0x0000000000caec91 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcaec91)
#36 0x0000000000ca681a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x00000000045ccac9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#38 0x0000000003b4e3f4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b4e3f4)
#39 0x00000000045cd0bf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#40 0x000000000459339d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x459339d)
#41 0x000000000459448d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x459448d)
#42 0x000000000459b845 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x459b845)
#43 0x0000000000cabac3 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcabac3)
#44 0x0000000000b7f544 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xb7f544)
#45 0x00007f3141029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x00007f3141029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000ca62ce _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xca62ce)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```

The issue can also be reproduced on Compiler Explorer:https://godbolt.org/z/sqE35r9ne
Please let me know if you need any more details.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWk9z27iS_zT0BUUVCVD8c_BBlu3sTGX2pcbZzFEFAk0JGxLgA0BbnsN89i2AlCnScmxnlKlsvZSjkoBG4_drNLqbBKgxYisBLoPlVbC8vqCd3Sl9KWhDpZKPjeoMMxel4o-XASb9H7oGw7RorVAyiFa_IJBMddKCBo4oYpqaHRISrWsqtyGO0MMOJGKqaUUt5BbZHaBK1bV6cL-Y4oCMFG0LNiCrIPJ_adT_sSBaCWlRQ4UMcB7gAgXZVRCtEFddWQPao4BcI5IFxLeiAN8G-BYxNzfiCowMcGYRZQxai-yOWi-22dDOqo19bAFpMFYLZtFee2UBTvcHdU99kwH7Z3LH3ZuVVY1gaE-92EHm0HwsSvfHIkF2fcx9Zgqzc79wMnAL74No9T9lJ203tNyDNkJJhKNFtIiQN9dVgK9whJM4xnlESE7SAF8ly3KZZiXkPOJh_Bfs2_ivg1C8JPkyW-AoKwJcBNHqM9VbvzJon6ebNAlbFtZCdvtwKzvXv9NAOWoUh9pJtcqIvXMLaSyta-DXQrv2AN92Rgf4thal-6zvmxBHAb4thfOiW9VJjhiVXHBqAX1Yr5HoVVDvaM9VbBkL8O2AaoSEb-P43ApJEK3uoAZmgf99TesnUE1XW-GGkBVaOCdIoiZNjid7UWLuJk-7E61V01DJ-_bPOxi2nsfqvrtO1B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