From ea141afa296c7cbb031e81188d132edef461ccf3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 13 Oct 2025 13:49:56 +1030 Subject: [PATCH] configurator: fix bad code in HAVE_UNALIGNED_ACCESS detection. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported on armhf, but applies to any 32-bit platform (detected at -O2 or above) ``` $ arm-linux-gnueabihf-gcc-13 -O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -c /tmp/foo.c -Wall /tmp/foo.c: In function ‘main’: /tmp/foo.c:4:23: error: expected expression before ‘int’ 4 | char pad[sizeof(*int) * 1]; | ^~~ /tmp/foo.c:4:11: warning: unused variable ‘pad’ [-Wunused-variable] 4 | char pad[sizeof(*int) * 1]; | ^~~ ``` Reported-by: https://github.com/Raimo33 Fixes: https://github.com/ElementsProject/lightning/issues/8501 Signed-off-by: Rusty Russell --- tools/configurator/configurator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 7d8f6b09..4efeaba3 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -413,7 +413,7 @@ static const struct test base_tests[] = { "#include \n" "int main(int argc, char *argv[]) {\n" " (void)argc;\n" - " char pad[sizeof(int *) * 1];\n" + " char pad[sizeof(int) + 1];\n" " memcpy(pad, argv[0], sizeof(pad));\n" " int *x = (int *)pad, *y = (int *)(pad + 1);\n" " return *x == *y;\n" -- 2.47.3