From ea5a10cbc141cf6d43bdc53f7b675008ac13e4ee Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 22 Jun 2025 10:32:26 +0200 Subject: [PATCH] copy-symbol: work around a bug in gcc On x86_64, gcc 12.2.0 from debian 12 miscompiles the code we had previously. It generates code that copies symbol.macfun and symbol.sfdef using an aligned move SSE instruction which requires 16 byte alignment of its operand. This alignment is not present in general, leading to a segfault for instance when calling (copy-symbol t t). By reordering the assignments, we avoid triggering the bug. --- src/c/symbol.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/symbol.d b/src/c/symbol.d index a89faaea9..e5193b641 100644 --- a/src/c/symbol.d +++ b/src/c/symbol.d @@ -335,12 +335,12 @@ cl_symbol_name(cl_object x) x->symbol.plist = cl_copy_list(sym->symbol.plist); x->symbol.undef_entry = sym->symbol.undef_entry; x->symbol.sfdef = sym->symbol.sfdef; - x->symbol.macfun = sym->symbol.macfun; if (ECL_FBOUNDP(sym)) { x->symbol.gfdef = sym->symbol.gfdef; } else { ECL_FMAKUNBOUND(x); } + x->symbol.macfun = sym->symbol.macfun; #ifdef ECL_THREADS x->symbol.binding = ECL_MISSING_SPECIAL_BINDING; #endif