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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 40029
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40029&action=edit
ubsan-pr77823.patch

Completely untested patch to allow libubsan handling vector types.
Though, not sure if it wouldn't be better to just always compute the sanitized
checks/operations for vectors as scalar, per element, operations.  It would be
certainly more precise, with this patch it would just report say for division
by { 5, 0, -1, 3 } that it is a division by -1 (or division by 0, but not
both).
For the arithmetic signed overflow checks, I think trying to implement it on
vectors might be too hard.  For cheaper tests like testing for shifts (e.g. lhs
< 0, or rhs < 0, or rhs >= bitsize, or division by 0 or by -1, etc.) e.g. SSE2
has pmovmskb instruction where we could check if any vector elements are false
or true, but I think we don't have something like that in GIMPLE IL.

Reply via email to