Re: BUG #16696: Backend crash in llvmjit

Dmitry Marakasov <amdmi3@amdmi3.ru>

From: Dmitry Marakasov <amdmi3@amdmi3.ru>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, Palle <girgen@pingpong.net>, pgsql-bugs@postgresql.org
Date: 2021-07-22T14:06:34Z
Lists: pgsql-bugs
* Thomas Munro (thomas.munro@gmail.com) wrote:

> On Thu, Jul 22, 2021 at 4:59 AM Andres Freund <andres@anarazel.de> wrote:
> > On 2021-07-18 17:13:50 +1200, Thomas Munro wrote:
> > > On Thu, May 20, 2021 at 2:49 AM Palle <girgen@pingpong.net> wrote:
> > > > This seems to still not be fixed. Is it planned for 14.0 release?
> > >
> > > I don't know enough about LLVM and TLS to have an opinion on the
> > > details, but I tested this and it works, and I think it should
> > > probably be back-patched based on the discussion so far (and hopefully
> > > in the future some way can be figured out to make it actually work?).
> 
> Done.
> 
> For the record, the original repro now causes PostgreSQL on FreeBSD
> (with INLINE_DEBUG defined) to say:
> 
> 2021-07-22 15:20:51.738 NZST [82982] DEBUG:  checking inlinability of boolin
> 2021-07-22 15:20:51.738 NZST [82982] DEBUG:  cannot inline boolin due
> to thread-local variable _ThreadRuneLocale
> 2021-07-22 15:20:51.738 NZST [82982] DEBUG:  had to skip inlining boolin
> 
> > FWIW, there's ongoing work in llvm to make the jit stuff handle TLS
> > correctly.
> 
> Cool.
> 
> Dmitry: Thanks very much for the report, reproducer, analysis and patch!

Superb, thanks a lot!

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:     https://github.com/AMDmi3  https://amdmi3.ru




Commits

  1. jit: Don't inline functions that access thread-locals.