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

Project / Subsystem

binutils / ld

Date

2026-07-19

Proposer

Alan Modra <amodra@gmail.com>

Source type

public_inbox

Consensus

Committed

Sentiment

/10

Technical tradeoffs

  • Choosing between using a wider integer type (`int32_t`) to directly accommodate larger values and resizing the variable and its test values to be safe across different `int` widths.

All attributes

project
binutils
subsystem
ld
patch_id
discussion_id
alyKoJflxVaaOlLY@squeak.grove.modra.org
source_type
public_inbox
title
Re: [PATCH] ld: testsuite: Fix integer overflow in ld/testsuite/ld-elf/init-mixed.c.
headline
ld testsuite: Fix integer overflow in init-mixed.c
tldr
Alan Modra commits a fix to an ld testsuite file, renaming a variable and using smaller values to avoid integer overflows.
proposer
Alan Modra <amodra@gmail.com>
consensus
Committed
outcome
committed
sentiment_score
technical_tradeoffs
  • Choosing between using a wider integer type (`int32_t`) to directly accommodate larger values and resizing the variable and its test values to be safe across different `int` widths.
series_id
series_role
standalone
series_parts
[]
tags
  • binutils
  • ld
  • testsuite
  • elf
  • integer-overflow
bugzilla_url
date
2026-07-19T00:00:00.000Z

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

This discussion resolves a potential integer overflow issue in an ld testsuite file. While the original patch proposed using int32_t, the maintainer opted for a different fix: renaming the count variable to order and using small values (0-6) to prevent overflow, even on targets with 16-bit integers. This change accounts for prior commits that enabled testing on such targets.