This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 9058b3622ebbcfb820712c7da97a434b3cd1da7c
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Sun Sep 13 06:38:29 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Thu Sep 24 18:08:16 2026 +0000

    swscale/uops: do not request loop vectorization under UBSan
    
    The null, pointer-overflow and alignment checks put a branch into every
    loop body and the vectorizer gives up, so clang warns about the
    transformation it was asked for on each loop that carries the pragma.
    Leave the hint out when the compiler reports UBSan, which clang and GCC
    14 or newer do through __has_feature. ASan alone does not block the
    vectorization.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/sanitizer.h  | 6 ++++++
 libswscale/uops_tmpl.h | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavutil/sanitizer.h b/libavutil/sanitizer.h
index 96ec8a5316..35dece3b26 100644
--- a/libavutil/sanitizer.h
+++ b/libavutil/sanitizer.h
@@ -28,6 +28,9 @@
 #if __has_feature(memory_sanitizer)
 #define HAVE_MSAN 1
 #endif
+#if __has_feature(undefined_behavior_sanitizer)
+#define HAVE_UBSAN 1
+#endif
 #endif
 #if defined(__SANITIZE_ADDRESS__)
 #undef  HAVE_ASAN
@@ -39,6 +42,9 @@
 #ifndef HAVE_MSAN
 #define HAVE_MSAN 0
 #endif
+#ifndef HAVE_UBSAN
+#define HAVE_UBSAN 0
+#endif
 
 /* Mark allocated memory that nothing may touch until it is unpoisoned. */
 #if HAVE_ASAN
diff --git a/libswscale/uops_tmpl.h b/libswscale/uops_tmpl.h
index 9015f26dad..c684ad3645 100644
--- a/libswscale/uops_tmpl.h
+++ b/libswscale/uops_tmpl.h
@@ -32,6 +32,7 @@
 #include <stdint.h>
 
 #include "libavutil/attributes.h"
+#include "libavutil/sanitizer.h"
 
 #include "ops_chain.h"
 #include "uops_macros.h"
@@ -62,7 +63,11 @@ typedef struct SwsOpIter {
     const SwsOpExec *exec;
 } SwsOpIter;
 
-#ifdef __clang__
+/* UBSan checks inside the loop body defeat the vectorizer, so do not ask
+ * for it in those builds. Clang warns for every loop otherwise. */
+#if HAVE_UBSAN
+#  define SWS_LOOP
+#elif defined(__clang__)
 #  define SWS_LOOP AV_PRAGMA(clang loop vectorize(assume_safety))
 #elif defined(__GNUC__)
 #  define SWS_LOOP AV_PRAGMA(GCC ivdep)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to