On Mon, 24 Mar 2025, Jakub Jelinek wrote: > On Mon, Mar 24, 2025 at 10:55:44PM +0100, Jakub Jelinek wrote: > > If it was HOST_WIDE_INT_MAX + (size_t) 1 to ~(size_t) 0, previously it would > > be false and now is false. > > Sorry, this case used to be false and now is true.
Just to add, when writing this I wondered whether a bool real_is_integer (const REAL_VALUE_TYPE *, wide_int *, int); would be useful, or adding an optional bool *exact arg to the existing real_to_integer. Semantics of -0.0 vs. 0.0 and INF/NAN (which previously, when casting to (size_t) was UB, likewise for out-of-bound values?) is of course details that need to be documented. I think the main issue with my transform is that it lost the non-negative check. The problem with the orignal code is that it lacks documentation on the intent of the check. Richard.