[Bug sanitizer/81281] [6/7/8 Regression] UBSAN: false positive, dropped promotion to long type.

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 4 14:52:00 GMT 2017


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 42785
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42785&action=edit
gcc8-pr81281-test.patch

This was fixed by r251651 for -fsanitize=undefined.  Attaching testcase in
patch form.  That said, without -fsanitize=unreachable the bug is still latent.
If we start just with:
  int a = (int) (-2024172551 - (long long)ci);
then we properly fold it into:
  int a = (int) (2270794745 - (unsigned int) ci);


More information about the Gcc-bugs mailing list