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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Assertion trunk crashes at getBytesReturnedByAllocSizeCall(clang::ASTContext const&, (anonymous namespace)::LValue const&, llvm::APInt&) ExprConstant.cpp:0:0
        </td>
    </tr>

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

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

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

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

Attempting to compile below program with Clang Assertion Trunk:
```c
void *my_malloc(unsigned) __attribute__((alloc_size(1)));
struct Data { };
void test() {
    struct Data *const data = my_malloc(sizeof(*xyz(data)));
    int gi = __builtin_object_size(data, 0);
}
```

Stack dump:
```
clang-20: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:16174: bool clang::Expr::EvaluateAsInt(clang::Expr::EvalResult&, const clang::ASTContext&, clang::Expr::SideEffectsKind, bool) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' 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-20240904/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20240904/lib/clang/20 -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20240904/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-90de95.o -x c <source>
1.      <source>:5:44: current parser token ';'
2.      <source>:3:13: parsing function body 'test'
3.      <source>:3:13: in compound statement ('{}')
 #0 0x0000000003b089d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x3b089d8)
 #1 0x0000000003b0611c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007c317d442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007c317d4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007c317d442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007c317d4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007c317d42871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007c317d439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000079b9447 (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x79b9447)
 #9 0x00000000079b95e4 getBytesReturnedByAllocSizeCall(clang::ASTContext const&, (anonymous namespace)::LValue const&, llvm::APInt&) ExprConstant.cpp:0:0
#10 0x00000000079c2ccc tryEvaluateBuiltinObjectSize(clang::Expr const*, unsigned int, (anonymous namespace)::EvalInfo&, unsigned long&) ExprConstant.cpp:0:0
#11 0x0000000007a112ad (anonymous namespace)::IntExprEvaluator::VisitBuiltinCallExpr(clang::CallExpr const*, unsigned int) ExprConstant.cpp:0:0
#12 0x0000000007a153c2 (anonymous namespace)::IntExprEvaluator::VisitCallExpr(clang::CallExpr const*) ExprConstant.cpp:0:0
#13 0x00000000079bc5d5 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#14 0x00000000079ac286 Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#15 0x00000000079b493b EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#16 0x00000000079b6f61 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x79b6f61)
#17 0x000000000678c507 GetExprRange(clang::ASTContext&, clang::Expr const*, unsigned int, bool, bool) SemaChecking.cpp:0:0
#18 0x00000000067b2c90 clang::Sema::CheckImplicitConversion(clang::Expr*, clang::QualType, clang::SourceLocation, bool*, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x67b2c90)
#19 0x00000000067b619d AnalyzeImplicitConversions(clang::Sema&, clang::Expr*, clang::SourceLocation, bool) (.constprop.0) SemaChecking.cpp:0:0
#20 0x00000000067b7d25 clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x67b7d25)
#21 0x0000000006c7ecfc clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x6c7ecfc)
#22 0x000000000691145f clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x691145f)
#23 0x00000000065a1af7 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65a1af7)
#24 0x00000000065b030b clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65b030b)
#25 0x00000000065b92e7 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65b92e7)
#26 0x00000000065b97a9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65b97a9)
#27 0x00000000066648da clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x66648da)
#28 0x0000000006665610 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x6665610)
#29 0x00000000066664e9 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x66664e9)
#30 0x0000000006667c6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x6667c6a)
#31 0x000000000657bdf3 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x657bdf3)
#32 0x00000000065b0d2d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65b0d2d)
#33 0x000000000656f9ee clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x656f9ee)
#34 0x000000000657019e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x657019e)
#35 0x00000000065767e7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65767e7)
#36 0x00000000065776bd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x65776bd)
#37 0x000000000656abaa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x656abaa)
#38 0x00000000044549e8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x44549e8)
#39 0x00000000046e6ad9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x46e6ad9)
#40 0x000000000466a0ae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x466a0ae)
#41 0x00000000047d057e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0x47d057e)
#42 0x0000000000ca9aef cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0xca9aef)
#43 0x0000000000ca2d3a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#44 0x0000000000ca666e clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0xca666e)
#45 0x0000000000b7a7b4 main (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0xb7a7b4)
#46 0x00007c317d429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#47 0x00007c317d429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#48 0x0000000000ca27ee _start (/opt/compiler-explorer/clang-assertions-trunk-20240904/bin/clang-20+0xca27ee)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW11v47iS_TXKC0FDor6shzw4dntusD3obCeYxT4ZFFVyOJFILUmlk_71C1JyYspO4sy0770L7KAnsGWyeM6pYrFI01RrvhUAl0F6FaSrC9qbe6kun_mfVCTzJL0oZfV8uZRtxxtQ6MtT10gFKogXKEiv7o3pdBAvArIOyHorq1I2ZibVNiDrnwFZq0iUN_-d_i6DdBWQ-enNSRGEqyBcDH8XxkDbGS62yEjEBjCohEb-QJ2SW0Vb9IObe7RsqNiihdagDJcC3alePNgBB2NZOPxjw_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