Re: gs_group_1 crashing on 13beta2/s390x
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Christoph Berg <myon@debian.org>, Tom Lane <tgl@sss.pgh.pa.us>, Andrew Gierth <andrew@tao11.riddles.org.uk>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Thomas Munro <thomas.munro@gmail.com>
Date: 2020-10-16T00:12:54Z
Lists: pgsql-hackers
Hi,
On 2020-10-15 15:37:01 -0700, Andres Freund wrote:
> On 2020-10-15 15:29:24 -0700, Andres Freund wrote:
> > Pushed now to 11-master.
>
> Ugh - there's a failure with an old LLVM version (3.9):
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dragonet&dt=2020-10-15%2022%3A24%3A04
>
> Need to rebuild that locally to reproduce.
It's a bug that was fixed in LLVM 4, but too late to be backported to
3.9.
The easiest seems to be to just use a wrapper function that does the
necessary pre-checks. Something like the below (in llvmjit_wrap.cpp).
Since the wrapper still needs to call into
LLVMGetAttributeCountAtIndexPG, it seems easier to just use the seperate
function name, rather than #define'ing LLVMGetAttributeCountAtIndex() to
the PG version?
/*
* Like LLVM's LLVMGetAttributeCountAtIndex(), works around a bug in LLVM 3.9.
*
* In LLVM <= 3.9, LLVMGetAttributeCountAtIndex() segfaults if there are no
* attributes at an index (fixed in LLVM commit ce9bb1097dc2).
*/
unsigned
LLVMGetAttributeCountAtIndexPG(LLVMValueRef F, uint32 Idx)
{
/*
* This is more expensive, so only do when using a problematic LLVM
* version.
*/
#if LLVM_VERSION_MAJOR < 4
if (!llvm::unwrap<llvm::Function>(F)->getAttributes().hasAttributes(Idx))
return 0;
#endif
/*
* There is no nice public API to determine the count nicely, so just
* always fall back to LLVM's C API.
*/
return LLVMGetAttributeCountAtIndex(F, Idx);
}
Greetings,
Andres Freund
Commits
-
llvmjit: Work around bug in LLVM 3.9 causing crashes after 72559438f92.
- c835c7ffe21d 12.5 landed
- 4a4f4487d2d2 11.10 landed
- fe2a16d8b3e6 14.0 landed
- efc9a8e9800c 13.1 landed
-
llvmjit: Also copy parameter / return value attributes from template functions.
- f3dee5b9aba6 11.10 landed
- c8a2bb0f1abf 12.5 landed
- ae3e75abab22 13.1 landed
- 72559438f92f 14.0 landed