[PATCH] D111109: AddGlobalAnnotations for function with or without function body.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 21 05:26:35 PDT 2021


On Thu, Oct 21, 2021 at 8:49 AM stan li <python3kgae at outlook.com> wrote:

> Hi Alex,
>
> I tried compile your repro on Windows with
>
> clang -S
>
> But it didn’t crash.
>
>
>
> Could you share the command line and environment to repro the crash?
>

I'm seeing the crash on linux on x86 with just `clang q.cc`. However, on
other platforms one may need cc1 arguments. The important ones seem to be:
$ clang++ -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
 -mconstructor-aliases q.cc
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang++ -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mconstructor-aliases q.cc
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x0000000004d910ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:11
 #1 0x0000000004d912bb PrintStackTraceSignalHandler(void*)
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x0000000004d8f826 llvm::sys::RunSignalHandlers()
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Support/Signals.cpp:96:5
 #3 0x0000000004d91a47 SignalHandler(int)
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f76f967d8e0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x138e0)
 #5 0x00000000014c09dc llvm::Value::getValueID() const
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/Value.h:533:12
 #6 0x00000000014c0be5 llvm::isa_impl<llvm::Constant, llvm::Value,
void>::doit(llvm::Value const&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/Value.h:952:29
 #7 0x00000000014c0bc5 llvm::isa_impl_cl<llvm::Constant, llvm::Value
const*>::doit(llvm::Value const*)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Support/Casting.h:105:5
 #8 0x00000000014c0b28 llvm::isa_impl_wrap<llvm::Constant, llvm::Value
const*, llvm::Value const*>::doit(llvm::Value const* const&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Support/Ca
sting.h:131:5
 #9 0x00000000014c0b02 llvm::isa_impl_wrap<llvm::Constant, llvm::Value*
const, llvm::Value const*>::doit(llvm::Value* const&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Support/Casting.
h:121:5
#10 0x00000000014c0ab5 bool llvm::isa<llvm::Constant,
llvm::Value*>(llvm::Value* const&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Support/Casting.h:142:3
#11 0x00000000014c0a15 llvm::cast_retty<llvm::Constant,
llvm::Value*>::ret_type llvm::cast<llvm::Constant,
llvm::Value>(llvm::Value*)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Support/
Casting.h:0:3
#12 0x0000000003494a39
llvm::LazyCallGraph::visitReferences(llvm::SmallVectorImpl<llvm::Constant*>&,
llvm::SmallPtrSetImpl<llvm::Constant*>&, llvm::function_ref<void
(llvm::Function&)>) /usr/local/google/home
/alexfh/work/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp:2000:19
#13 0x00000000034952c4 llvm::LazyCallGraph::LazyCallGraph(llvm::Module&,
llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>)
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Analysis/LazyC
allGraph.cpp:208:1
#14 0x0000000006a03ed9 llvm::LazyCallGraphAnalysis::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/Analysis/LazyCallGraph.h:1257:12
#15 0x0000000006a03d58 llvm::detail::AnalysisPassModel<llvm::Module,
llvm::LazyCallGraphAnalysis, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module>::Invalidator>::run(llvm::Module&,
llvm::AnalysisM
anager<llvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:323:12
#16 0x000000000412519b
llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*,
llvm::Module&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:73:35
#17 0x00000000033b8c43 llvm::LazyCallGraphAnalysis::Result&
llvm::AnalysisManager<llvm::Module>::getResult<llvm::LazyCallGraphAnalysis>(llvm::Module&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/incl
ude/llvm/IR/PassManager.h:786:21
#18 0x00000000033adc08
llvm::InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC,
llvm::LazyCallGraph&>, llvm::Module>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) /usr/local
/google/home/alexfh/work/llvm-project/llvm/lib/Analysis/CGSCCPassManager.cpp:673:30
#19 0x0000000006a73537 llvm::detail::AnalysisPassModel<llvm::Module,
llvm::InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC,
llvm::LazyCallGraph&>, llvm::Module>, llvm::PreservedAnalys
es, llvm::AnalysisManager<llvm::Module>::Invalidator>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:324:1
4
#20 0x000000000412519b
llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*,
llvm::Module&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:73:35
#21 0x00000000033b8b73
llvm::InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC,
llvm::LazyCallGraph&>, llvm::Module>::Result&
llvm::AnalysisManager<llvm::Module>::getResult<llvm::InnerA
nalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC,
llvm::LazyCallGraph&>, llvm::Module> >(llvm::Module&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManager.h:786
:21
#22 0x00000000033ab373
llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/lib/Analysis/CGSCCPassManager.cpp:
144:56
#23 0x0000000004302e9b llvm::detail::PassModel<llvm::Module,
llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<l
lvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
#24 0x0000000004121eab llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/usr/local/google/home/alexfh/work/llvm-project/llvm/incl
ude/llvm/IR/PassManager.h:525:16
#25 0x0000000005260440 (anonymous
namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >&, std::u
nique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>
>&)
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1473:3
#26 0x00000000052587d9 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) /usr/local/google/
home/alexfh/work/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1536:22
#27 0x0000000005256f48 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::String
Ref, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/CodeGen/BackendUtil
.cpp:1697:5
#28 0x00000000068d0c7f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:370:7
#29 0x0000000008738c0c clang::ParseAST(clang::Sema&, bool, bool)
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/Parse/ParseAST.cpp:178:12
#30 0x0000000005d50ba2 clang::ASTFrontendAction::ExecuteAction()
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1071:1
#31 0x00000000068cc319 clang::CodeGenAction::ExecuteAction()
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1108:5
#32 0x0000000005d50551 clang::FrontendAction::Execute()
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/Frontend/FrontendAction.cpp:966:7
#33 0x0000000005c8468a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/usr/local/google/home/alexfh/work/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1030:23


>
> Thanks
>
> Xiang
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows
>
>
> ------------------------------
> *From:* Alexander Kornienko via Phabricator <reviews at reviews.llvm.org>
> *Sent:* Wednesday, October 20, 2021 4:10:42 PM
> *To:* python3kgae at outlook.com <python3kgae at outlook.com>;
> mizvekov at gmail.com <mizvekov at gmail.com>; blitzrakete at gmail.com <
> blitzrakete at gmail.com>; notstina at gmail.com <notstina at gmail.com>;
> shenhan at google.com <shenhan at google.com>; richard at metafoo.co.uk <
> richard at metafoo.co.uk>; bhuvanendra.kumarn at amd.com <
> bhuvanendra.kumarn at amd.com>; mlekena at skidmore.edu <mlekena at skidmore.edu>;
> jlerouge at apple.com <jlerouge at apple.com>; chris.bieneman at me.com <
> chris.bieneman at me.com>; aaron.ballman at gmail.com <aaron.ballman at gmail.com>
> *Cc:* alexfh at google.com <alexfh at google.com>; ndesaulniers at google.com <
> ndesaulniers at google.com>; cfe-commits at lists.llvm.org <
> cfe-commits at lists.llvm.org>; david.green at arm.com <david.green at arm.com>;
> ruiling.song at amd.com <ruiling.song at amd.com>
> *Subject:* [PATCH] D111109: AddGlobalAnnotations for function with or
> without function body.
>
> alexfh added a comment.
>
> Reduced the test further to:
>
>   struct k {
>     ~k() __attribute__((annotate(""))) {}
>   };
>   void m() { k(); }
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D111109/new/
>
> https://reviews.llvm.org/D111109
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211021/97c9e231/attachment-0001.html>


More information about the cfe-commits mailing list