[COMMITTED] gas: sframe: do not test whether offsetT exceeds INT64_MIN..INT64_MAX

Jan Beulich jbeulich@suse.com
Tue Jan 13 13:59:59 GMT 2026


On 13.01.2026 14:24, Jens Remus wrote:
> A value of type offsetT, which is either a signed 32-bit or 64-bit
> integer, cannot exceed the range of INT64_MIN..INT64_MAX.  This
> resolves the following compile error:
> 
> ../../binutils-gdb/gas/gen-sframe.c: In function ‘get_offset_size_in_bytes’:
> ../../binutils-gdb/gas/gen-sframe.c:213:45: error: comparison is always true due to limited range of data type [-Werror=type-limits]
>   213 |   else if ((sizeof (offsetT) > 4) && (value <= INT64_MAX && value >= INT64_MIN))
>       |                                             ^~
> ../../binutils-gdb/gas/gen-sframe.c:213:67: error: comparison is always true due to limited range of data type [-Werror=type-limits]
>   213 |   else if ((sizeof (offsetT) > 4) && (value <= INT64_MAX && value >= INT64_MIN))

This same error ...

> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -210,7 +210,7 @@ get_offset_size_in_bytes (offsetT value)
>      size = 2;
>    else if (value <= INT32_MAX && value >= INT32_MIN)

... will trigger here on a !BFD64 build.

Jan

>      size = 4;
> -  else if ((sizeof (offsetT) > 4) && (value <= INT64_MAX && value >= INT64_MIN))
> +  else if (sizeof (offsetT) > 4)
>      size = 8;
>  
>    return size;



More information about the Binutils mailing list