Lua 5.4 was released recently, and I rushed to install in on my Fedora 32 system. It built just fine but here is a rough transcript of my first interaction with the interpreter:

Lua 5.4.0  Copyright (C) 1994-2020 Lua.org, PUC-Rio
> 'hi'
hi
> 3.14 
Bus Error (Core Dumped)

That’s not good. I recompiled with debug flags and re-ran the crash in gdb. It looked like a pointer got overwritten, since it looked suspiciously non-random. I forget the exact number, but it was like 0xf1832ccccccccccc. When I went to report it on the “lua-bugs” mailing list, it turned out that it had already been reported.

On that mail thread, they quickly identified it as a GCC 10.1 bug having to do with union argument passing. The key thing to notice is that the function in question is (a) static, (b) small, and (c) only called in two locations. So, I marked the function inline so that any argument passing would be optimized away. That works around the bug. So far, I haven’t run across any more problems!

Here’s the patch if anyone else needs it:

diff -ru lua-5.4.0/src/lobject.c rwtlua-5.4.0/src/lobject.c
--- lua-5.4.0/src/lobject.c	2020-06-18 09:25:53.000000000 -0500
+++ rwtlua-5.4.0/src/lobject.c	2020-07-17 17:57:25.159532363 -0500
@@ -340,7 +340,7 @@
 /*
 ** Convert a number object to a string, adding it to a buffer
 */
-static int tostringbuff (TValue *obj, char *buff) {
+static inline int tostringbuff (TValue *obj, char *buff) {
   int len;
   lua_assert(ttisnumber(obj));
   if (ttisinteger(obj))