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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Assertion `Type <= 3 && "unexpected type"` failed in `bool {anonymous}::IntExprEvaluator::VisitBuiltinCallExpr(const clang::CallExpr*, unsigned int)`
        </td>
    </tr>

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

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

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

<pre>
    Probably goes back to clang-9: https://godbolt.org/z/ofvMExead

Generated by fuzzer that modifies literals to 1024LL

Reduced Test:

```c++
void copy5CharsInto(char *buf)
 __attribute__((enable_if(__builtin_object_size(buf, 1024LL) != -1024LL &&
 __builtin_object_size(buf, 1024LL) > 1024LL,
 "")));
```

Stack Dump:

```
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ExprConstant.cpp:12981: bool {anonymous}::IntExprEvaluator::VisitBuiltinCallExpr(const clang::CallExpr*, unsigned int): Assertion `Type <= 3 && "unexpected 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 <source>
1.      <source>:4:35: current parser token ';'
 #0 0x0000000003f78848 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f78848)
 #1 0x0000000003f764d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f764d4)
 #2 0x0000000003ebb048 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000739cade42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000739cade969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000739cade42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000739cade287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000739cade2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000739cade39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000078bd4d2 (anonymous namespace)::IntExprEvaluator::VisitBuiltinCallExpr(clang::CallExpr const*, unsigned int) ExprConstant.cpp:0:0
#10 0x00000000078bd861 (anonymous namespace)::IntExprEvaluator::VisitCallExpr(clang::CallExpr const*) ExprConstant.cpp:0:0
#11 0x000000000785e4a7 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#12 0x000000000789bfb8 (anonymous namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*) ExprConstant.cpp:0:0
#13 0x000000000785e58b clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#14 0x000000000784d3a6 Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#15 0x00000000078b505e (anonymous namespace)::IntExprEvaluator::VisitBinaryOperator(clang::BinaryOperator const*) ExprConstant.cpp:0:0
#16 0x000000000785f36d clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#17 0x000000000784d3a6 Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#18 0x000000000785da81 clang::Expr::isPotentialConstantExprUnevaluated(clang::Expr*, clang::FunctionDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x785da81)
#19 0x0000000006a2be73 checkFunctionConditionAttr(clang::Sema&, clang::Decl*, clang::ParsedAttr const&, clang::Expr*&, llvm::StringRef&) (.constprop.0) SemaDeclAttr.cpp:0:0
#20 0x0000000006a2c6a6 handleEnableIfAttr(clang::Sema&, clang::Decl*, clang::ParsedAttr const&) SemaDeclAttr.cpp:0:0
#21 0x0000000006a4d1af ProcessDeclAttribute(clang::Sema&, clang::Scope*, clang::Decl*, clang::ParsedAttr const&, clang::Sema::ProcessDeclAttributeOptions const&) (.isra.0) SemaDeclAttr.cpp:0:0
#22 0x0000000006a4f073 clang::Sema::ProcessDeclAttributes(clang::Scope*, clang::Decl*, clang::Declarator const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a4f073)
#23 0x0000000006a0011c clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a0011c)
#24 0x0000000006a06911 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a06911)
#25 0x0000000006a074a0 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a074a0)
#26 0x0000000006659164 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6659164)
#27 0x0000000006668e79 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6668e79)
#28 0x00000000066276be clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66276be)
#29 0x0000000006627e69 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6627e69)
#30 0x000000000662f7aa clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x662f7aa)
#31 0x000000000663077d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663077d)
#32 0x0000000006630c30 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6630c30)
#33 0x0000000006622ab3 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6622ab3)
#34 0x000000000492ed48 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x492ed48)
#35 0x0000000004c28c65 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c28c65)
#36 0x0000000004ba5ffe clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ba5ffe)
#37 0x0000000004d1b441 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d1b441)
#38 0x0000000000d8e81f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd8e81f)
#39 0x0000000000d853fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#40 0x0000000004995b49 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
#41 0x0000000003ebb4e4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ebb4e4)
#42 0x000000000499615f 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
#43 0x0000000004957f8d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4957f8d)
#44 0x000000000495901e 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+++0x495901e)
#45 0x00000000049614d5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49614d5)
#46 0x0000000000d8accf clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd8accf)
#47 0x0000000000c41924 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc41924)
#48 0x0000739cade29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#49 0x0000739cade29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#50 0x0000000000d84ea5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd84ea5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4yrS_jXKDeWUhGR9XORC48TnzamcmtQk77l1IWjZbGTQAsqx59dvgWTLkp3MeCae3bM75anYApqnn266GwTRmi8FwI03_eRNb69IY1ZS3Xxp9CrwcRheFZJtbx6VLEhRbdFSgkYFoS_ISEQrIpaTzAtztDKm1l6Ye3ju4flSskJW5lqqpYfnXz08l-XrH3cbIMzzc8_PfwMBihhgqNiisvn6FRQyK2LQWjJectCo4gYUqbSdJ_Bx9PDQjvwCrKHA0DNoY-dzD73Ybz_Uw5_sx89fJWeIyno7na2I0vfCSA-ndEUU8nBeNKWHM8_P0WJBjFG8aAwsFh5OPZyCIEUFC156OF0sioZXhouFLP4B1Cw0_woeTp2A2Q4ZzpCHAy-8RZP2CfJwbD9ugu-VEN7tf83sSA9j98m6T_jpUNVW8ydjbXHbrOtjMjw_dxbqOAmtxLmS0nh4XlWv60mtpEXU_fTw3EhZaQ_Pu2HzihcenudPzx6e321qNZNCGyLMNa3tfAHO0sDKLaSskJd8IkKK7Vo22ktuLZ4wvxfGDrx7JVVDjFTt0z-55uZTS8uMVJXtYq1jxbde1fbr23LLVSOcrzLEhXGE5CjXGpThUiAv9p-3NSAvnFlDhJ0JLIuNgE0N1Lqb2dbgSE1QSXgF7Nrz88eHu_zpDummWHODCCqaJVJQS2Ws941cm5tVU1xTue5pG5HJtW7A0oiIsFhp1TBAZgWIKqJXbvkYRShYnWoFtZIUtAaGtGxU-9iOJFpLyt0qUY1Amipem-u90dne6P6152ePSi4VWSOils0ahNGdwWVtMVG5rnkF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