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

Jan Dubiec <[email protected]> Fri, 17 Jul 2026 18:11:22 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
The code assumes that int is 32 bits wide (see e.g. line 97), which is
not necessarily true.

Signed-off-by: Jan Dubiec <[email protected]>
---
 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