[clang] [Clang][counted_by] Refactor __builtin_dynamic_object_size on FAMs (PR #122198)

Nathan Chancellor via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 31 09:31:11 PST 2025


nathanchance wrote:

This breaks `ARCH=arm64 allmodconfig` for me.

```
$ echo CONFIG_WERROR=n >kernel/configs/no-werror.config

$ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper {allmod,no-werror.}config drivers/net/ethernet/sfc/falcon/falcon.o
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: /mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang ...
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      drivers/net/ethernet/sfc/falcon/falcon.c:1099:13: Generating code for declaration 'falcon_reconfigure_xmac_core'
4.      drivers/net/ethernet/sfc/falcon/falcon.c:1149:2 <Spelling=include/linux/fortify-string.h:626:42>: LLVM IR generation of compound statement ('{}')
 #0 0x000055636ce677c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x436f7c8)
 #1 0x000055636ce652ee llvm::sys::RunSignalHandlers() (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x436d2ee)
 #2 0x000055636cdea976 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fe53564c1d0 (/usr/lib/libc.so.6+0x3d1d0)
 #4 0x000055636d415238 clang::CodeGen::CodeGenFunction::emitCountedByMemberSize(clang::Expr const*, llvm::Value*, unsigned int, llvm::IntegerType*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x491d238)
 #5 0x000055636d41489f clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x491c89f)
 #6 0x000055636d41de14 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4925e14)
 #8 0x000055636d27dd2a (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
 #9 0x000055636d26a64b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#10 0x000055636d26a53d clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x477253d)
#11 0x000055636d2b42d0 clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x47bc2d0)
#12 0x000055636d2b78dc clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x47bf8dc)
#13 0x000055636d2b1c69 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x47b9c69)
#14 0x000055636d2b14ef clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x47b94ef)
#15 0x000055636d1e146b clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46e946b)
#16 0x000055636d1d4d53 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46dcd53)
#17 0x000055636d1d42f4 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46dc2f4)
#18 0x000055636d1e2652 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46ea652)
#19 0x000055636d1e1399 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46e9399)
#20 0x000055636d2797e7 (anonymous namespace)::ScalarExprEmitter::VisitStmtExpr(clang::StmtExpr const*) CGExprScalar.cpp:0:0
#21 0x000055636d26a53d clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x477253d)
#22 0x000055636d23cb84 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4744b84)
#23 0x000055636d1d43e7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46dc3e7)
#24 0x000055636d1e2830 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46ea830)
#25 0x000055636d1c0676 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x46c8676)
#26 0x000055636d091cc0 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4599cc0)
#27 0x000055636d08958f clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x459158f)
#28 0x000055636d079b6b clang::CodeGen::CodeGenModule::EmitDeferred() (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4581b6b)
#29 0x000055636d079b97 clang::CodeGen::CodeGenModule::EmitDeferred() (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4581b97)
#30 0x000055636d07668a clang::CodeGen::CodeGenModule::Release() (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x457e68a)
#31 0x000055636d6bfc9b (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#32 0x000055636d6b828e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4bc028e)
#33 0x000055636eb46ab9 clang::ParseAST(clang::Sema&, bool, bool) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x604eab9)
#34 0x000055636daff8e6 clang::FrontendAction::Execute() (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x50078e6)
#35 0x000055636da729ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4f7a9ad)
#36 0x000055636dbc77ba clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x50cf7ba)
#37 0x000055636b634ae5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x2b3cae5)
#38 0x000055636b630bbf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x000055636d8f3c69 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::$_0>(long) Job.cpp:0:0
#40 0x000055636cdea6fe llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x42f26fe)
#41 0x000055636d8f3303 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4dfb303)
#42 0x000055636d8b60bc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4dbe0bc)
#43 0x000055636d8b62d7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4dbe2d7)
#44 0x000055636d8d2238 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x4dda238)
#45 0x000055636b630447 clang_main(int, char**, llvm::ToolContext const&) (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x2b38447)
#46 0x000055636b63fe37 main (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x2b47e37)
#47 0x00007fe535634e08 (/usr/lib/libc.so.6+0x25e08)
#48 0x00007fe535634ecc __libc_start_main (/usr/lib/libc.so.6+0x25ecc)
#49 0x000055636b62e765 _start (/mnt/nvme/tmp/build/llvm-project-testing/final/bin/clang+0x2b36765)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
ClangBuiltLinux clang version 21.0.0git (https://github.com/llvm/llvm-project.git cff0a460ae864505bc2a064c269ebe548aa35949)
...
```

I can reduce up something shortly.

https://github.com/llvm/llvm-project/pull/122198


More information about the cfe-commits mailing list