[PATCH] ld: testsuite: Fix integer overflow in ld/testsuite/ld-elf/init-mixed.c.

Jan Dubiec jdx@o2.pl
Fri Jul 17 16:11:22 GMT 2026


The code assumes that int is 32 bits wide (see e.g. line 97), which is
not necessarily true.

Signed-off-by: Jan Dubiec <jdx@o2.pl>
---
 ld/testsuite/ld-elf/init-mixed.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ld/testsuite/ld-elf/init-mixed.c b/ld/testsuite/ld-elf/init-mixed.c
index f401ded4d70..d8ee578cc27 100644
--- a/ld/testsuite/ld-elf/init-mixed.c
+++ b/ld/testsuite/ld-elf/init-mixed.c
@@ -1,9 +1,10 @@
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 
 #ifdef HAVE_INITFINI_ARRAY
-static int count;
+static int32_t count;
 
 static void
 init1005 ()
-- 
2.54.0


More information about the Binutils mailing list