https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69751

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to mgans...@alice.de from comment #0)
> series.c:90:99: error: call of overloaded 'abs(size_t)' is ambiguous
>                 if (::abs(strlen(evtCompShortText) -
> strlen(episodeDb->getStrValue("COMPPARTNAME"))) >= dMin)
>                                                                             

This doesn't do what the author of that code thinks it does. If the second
string is longer than the first then the difference between them is not a
negative number, it's a huge unsigned value. Calling abs(int) on a huge
unsigned value will overflow and is undefined behaviour.

This is exactly why calling abs() here should be an error: the code has
undefined behaviour and should be fixed.

Reply via email to