[Bug libstdc++/94747] Undefined behavior: integer overflow in libsupc++/dyncast.cc

2020-04-24 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94747

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Jonathan Wakely  ---
(In reply to AK from comment #0)
> Integer overflow reported by asan with the following stack trace.

asan?! Are you sure?

As Jakub says, this is probably the dumb "unsigned-integer-overflow" sanitizer,
which is dumb because unsigned integers can't overflow by definition (they
wrap) and because that wrapping is never undefined.

The code is fine.

[Bug libstdc++/94747] Undefined behavior: integer overflow in libsupc++/dyncast.cc

2020-04-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94747

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Negation of unsigned long value is well defined for all possible values,
including 16.
Is that with the flawed clang -fsanitize=unsigned-integer-overflow ?
GCC doesn't implement that for a reason.