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

    <tr>
        <th>Summary</th>
        <td>
            Clang crashes with segmentation fault when using `target_clones` attribute with redefined `int` and old-style function definition
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Compiler Explorer: [https://godbolt.org/z/eP57zqoPK](https://godbolt.org/z/eP57zqoPK)

(Found by fuzzer)

Crash Output and Stack Trace:
```
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-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 -O1 <source>
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
 #0 0x0000000003b583f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3b583f8)
 #1 0x0000000003b5653c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3b5653c)
 #2 0x0000000003aa58c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000748ae7242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000006f6f3fa clang::ASTContext::forEachMultiversionedFunctionVersion(clang::FunctionDecl const*, llvm::function_ref<void (clang::FunctionDecl*)>) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x6f6f3fa)
 #5 0x00000000040d6ee5 clang::CodeGen::CodeGenModule::emitMultiVersionFunctions() (/opt/compiler-explorer/clang-trunk/bin/clang+0x40d6ee5)
 #6 0x00000000040d8de0 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-trunk/bin/clang+0x40d8de0)
 #7 0x00000000044d650e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
 #8 0x00000000044d353d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x44d353d)
 #9 0x00000000060471ec clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x60471ec)
#10 0x00000000044d3e95 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x44d3e95)
#11 0x00000000047ae771 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x47ae771)
#12 0x000000000472f3ab clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x472f3ab)
#13 0x000000000489bbf3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x489bbf3)
#14 0x0000000000d668a1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xd668a1)
#15 0x0000000000d5f00d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#16 0x0000000004520499 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
#17 0x0000000003aa5cf3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3aa5cf3)
#18 0x00000000045206b9 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
#19 0x00000000044e441d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x44e441d)
#20 0x00000000044e53b1 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x44e53b1)
#21 0x00000000044ef76c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x44ef76c)
#22 0x0000000000d634c1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xd634c1)
#23 0x0000000000c24d54 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xc24d54)
#24 0x0000748ae7229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x0000748ae7229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x0000000000d5eaa5 _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xd5eaa5)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```


Source Code:
```c
#define int unsigned

struct foo {
  int a : 1;
};

int __attribute__((target_clones("default,avx"))) foo(a)
struct foo a;
{
 return 0;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWU9z277R_jTwBUMNBf4RedBBlq33_aXJxBOnuWpAYCmhAQEWAB05n74DkDJJxU6T2O2lGWZMgovdB88udpcQtVYcFMAaZdcou7minTtqs65Ezq4qzR_XW920QoLBt6dWagMGJRuMsuujc61FyQaRHSK7g-aVlm6hzQGR3XdEdnCXrb7_U9_9DWU3iBS_Lk5KFG_8RYqd7hTH1SOuu-_fwTy92hpqj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