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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

    int x = 
# 6 "err_file.c" 3 4
           (-0x7fffffff - 1)
# 6 "err_file.c"
                  ;
    int y = x * -1;


x*-1 invokes undefined behavior because signed integer overflow is undefined.
So anything can happen after undefined behavior including but not limited to
inconsistent results.

You can detect signed integer overflow at run time with -fsanitize=undefined.

Reply via email to