> Am 25.11.2025 um 04:29 schrieb Siddhesh Poyarekar <[email protected]>:
> 
> SSIZE_MAX may not always be available, so build it using (size_t) -1
> instead.

Ok

Richard 


> gcc/lto/ChangeLog:
> 
>    PR lto/122515
>    * lto-common.cc (lto_read_section_data): Avoid using SSIZE_MAX.
> 
> Signed-off-by: Siddhesh Poyarekar <[email protected]>
> ---
> 
> Testing:
> 
> - Bootstrapped on x86_64
> - Built and tested cross i686 as well as with i686 runtime
> - Requested Romain to test with their configuration as well
> 
> gcc/lto/lto-common.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
> index 3d35c038916..13aca2c9d2a 100644
> --- a/gcc/lto/lto-common.cc
> +++ b/gcc/lto/lto-common.cc
> @@ -2438,7 +2438,7 @@ lto_read_section_data (struct lto_file_decl_data 
> *file_data,
> 
>   computed_offset = offset & ((off_t) page_mask);
>   diff = offset - computed_offset;
> -  if (len > (size_t) (SSIZE_MAX - diff))
> +  if (len > (((size_t) -1) >> 1) - diff)
>     {
>       fatal_error (input_location, "Cannot map %s: section is too long",
>           file_data->file_name);
> --
> 2.50.1
> 

Reply via email to