PR #22797 opened by Niklas Haas (haasn)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22797
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22797.patch

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22796
See-also: https://discourse.llvm.org/t/fp-contraction-fma-on-by-default/64975
Signed-off-by: Niklas Haas <[email protected]>


>From f44725ca578177f990e05639783778013148e2d1 Mon Sep 17 00:00:00 2001
From: Niklas Haas <[email protected]>
Date: Sun, 12 Apr 2026 16:14:38 +0200
Subject: [PATCH] swscale/ops_backend: disable FP contraction on clang

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22796
See-also: https://discourse.llvm.org/t/fp-contraction-fma-on-by-default/64975
Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_backend.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libswscale/ops_backend.c b/libswscale/ops_backend.c
index e7aaeda9d4..94fd59bf98 100644
--- a/libswscale/ops_backend.c
+++ b/libswscale/ops_backend.c
@@ -20,6 +20,15 @@
 
 #include "ops_backend.h"
 
+/**
+ * GCC disables FP contraction by default in standard C mode (e.g. -std=c11),
+ * but clang doesn't care and always contracts if the target supports it. Since
+ * this is a reference backend, we always want the bit-exact result.
+ */
+#ifdef __clang__
+#pragma STDC FP_CONTRACT OFF
+#endif
+
 #if AV_GCC_VERSION_AT_LEAST(4, 4)
 #pragma GCC optimize ("finite-math-only")
 #endif
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to