[Bug bootstrap/49914] call to abs(long long) in gcc/fold-const.c
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Aug 2 12:33:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49914
--- Comment #9 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-08-02 12:32:24 UTC ---
On Tue, 2 Aug 2011, rguenther at suse dot de wrote:
> well, I don't think we want the assert in abs_hwi as it stands now.
> Either we can handle this case in the callers or we should just do
> what we can - exploit the undefined behavior and return INT_MIN for
> INT_MIN.
If a caller is prepared to get a negative value back from abs_hwi, then an
abs_hwi_wrap version would seem appropriate for such a caller (or a
version that returns unsigned HOST_WIDE_INT, if the callers are written to
work with unsigned values). If a caller expects the result to be positive
and always the absolute value (but of a signed type), it's a bug in the
caller to pass the least HOST_WIDE_INT value, and the assert serves to
detect such a bug in the caller.
More information about the Gcc-bugs
mailing list