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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Already doing such address arithmetics is UB (though of course a + 10 is ok
above), but we don't have a warning for that and as I said in another PR, ubsan
could detect only the cases where the compiler can see at compile time the
exact object boundaries, and it would need to be soon before it is optimized
away (in the above testcase it isn't really used, in other cases it could be
changed into UB.

Perhaps we should just change ubsan_expand_ptr_ifn, if we don't know what the
base points at, use what we do right now (the cheap check), if we do and it
isn't  something we should punt on (e.g. common symbols with
flag_unconstrained_commons, or maybe external decls (not sure if all or some
cases).

Reply via email to