BUG #17965: SIGSEGV from LLVM13 JIT when executing SQL. - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17965: SIGSEGV from LLVM13 JIT when executing SQL.
Date
Msg-id 17965-fc1a097e2c100e99@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17965
Logged by:          Jingtang Zhang
Email address:      mrdrivingduck@gmail.com
PostgreSQL version: 14.8
Operating system:   CentOS 7
Description:

Hi~ PG hackers. Recently I meet up this core dump on latest REL_14_STABLE
branch, while executing `make check` under `contrib/ltree`.
According to the stack trace, it is from libLLVM13.so. I'm not so sure about
whether it is a bug of LLVM or PostgreSQL. Any ideas? And
what is the recommended version of LLVM to use now?

(gdb) bt
#0  0x00007f98ce36529a in llvm::TargetTransformInfoWrapperPass&
llvm::Pass::getAnalysis<llvm::TargetTransformInfoWrapperPass>() const ()
   from /lib64/libLLVM-13.so
#1  0x00007f98ce6c3c9c in std::_Function_handler<llvm::TargetTransformInfo
const& (llvm::Function&), (anonymous
namespace)::IPSCCPLegacyPass::runOnModule(llvm::Module&)::{lambda(llvm::Function&)#2}>::_M_invoke(std::_Any_data
const&, llvm::Function&) () from /lib64/libLLVM-13.so
#2  0x00007f98ce0f67e0 in
llvm::SCCPInstVisitor::handleCallArguments(llvm::CallBase&) () from
/lib64/libLLVM-13.so
#3  0x00007f98ce0f99ae in
llvm::SCCPInstVisitor::markUsersAsChanged(llvm::Value*) () from
/lib64/libLLVM-13.so
#4  0x00007f98ce0f9a5e in llvm::SCCPInstVisitor::solve() () from
/lib64/libLLVM-13.so
#5  0x00007f98ce4fbde6 in llvm::runIPSCCP(llvm::Module&, llvm::DataLayout
const&, std::function<llvm::TargetLibraryInfo const& (llvm::Function&)>,
std::function<llvm::TargetTransformInfo const& (llvm::Function&)>,
llvm::function_ref<llvm::AnalysisResultsForFn (llvm::Function&)>) ()
   from /lib64/libLLVM-13.so
#6  0x00007f98ce6c2ece in (anonymous
namespace)::IPSCCPLegacyPass::runOnModule(llvm::Module&) () from
/lib64/libLLVM-13.so
#7  0x00007f98cd637099 in llvm::legacy::PassManagerImpl::run(llvm::Module&)
() from /lib64/libLLVM-13.so
#8  0x00007f98cd588fc9 in LLVMRunPassManager () from /lib64/libLLVM-13.so
#9  0x00007f98da34aac3 in llvm_optimize_module (module=<optimized out>,
context=0x2d01a08) at llvmjit.c:620
#10 llvm_compile_module (context=0x2d01a08) at llvmjit.c:671
#11 llvm_get_function (context=0x2d01a08, funcname=0x2d64c40 "evalexpr_0_0")
at llvmjit.c:291
#12 0x00007f98da354d5d in ExecRunCompiledExpr (state=0x2d64288,
econtext=0x2d63fe8, isNull=0x7ffe033b1c2f) at llvmjit_expr.c:2402
#13 0x00000000006c5f9f in ExecEvalExprSwitchContext (isNull=0x7ffe033b1c2f,
econtext=0x2d63fe8, state=0x2d64288)
    at ../../../src/include/executor/executor.h:342
#14 ExecQual (econtext=0x2d63fe8, state=0x2d64288) at
../../../src/include/executor/executor.h:411
#15 ExecScan (node=0x2d63ed0, accessMtd=0x6eecc0 <SeqNext>,
recheckMtd=0x6eecb0 <SeqRecheck>) at execScan.c:226
#16 0x00000000006cdbe1 in ExecProcNode (node=0x2d63ed0) at
../../../src/include/executor/executor.h:260
#17 fetch_input_tuple (aggstate=aggstate@entry=0x2d63878) at nodeAgg.c:581
#18 0x00000000006d0aa0 in agg_retrieve_direct (aggstate=<optimized out>) at
nodeAgg.c:2364
#19 ExecAgg (pstate=<optimized out>) at nodeAgg.c:2179
#20 0x00000000006bcd0b in ExecProcNode (node=0x2d63878) at
../../../src/include/executor/executor.h:260
#21 ExecutePlan (execute_once=<optimized out>, dest=0x2e3fe50,
direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>, 
    operation=CMD_SELECT, use_parallel_mode=<optimized out>,
planstate=0x2d63878, estate=0x2d63640) at execMain.c:1551
#22 standard_ExecutorRun (queryDesc=0x2d88ab0, direction=<optimized out>,
count=0, execute_once=<optimized out>) at execMain.c:361
#23 0x00000000008415bc in PortalRunSelect (portal=0x2cec830,
forward=<optimized out>, count=0, dest=<optimized out>) at pquery.c:921
#24 0x0000000000842a81 in PortalRun (portal=portal@entry=0x2cec830,
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, 
    run_once=run_once@entry=true, dest=dest@entry=0x2e3fe50,
altdest=altdest@entry=0x2e3fe50, qc=0x7ffe033b1fb0) at pquery.c:765
#25 0x000000000083eaaa in exec_simple_query (query_string=0x2c89b30 "SELECT
count(*) FROM _ltreetest WHERE t @> '1.1.1' ;") at postgres.c:1213

Thanks~


pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: BUG #17964: Missed query planner optimization
Next
From: PG Bug reporting form
Date:
Subject: BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen