PR #25165 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25165
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25165.patch

At -O2 and above gcc 10 to 14 lose track of the FPSCR precision mode on
sh4 and execute fldi0 while double precision is selected, which traps
with an illegal instruction. In FATE this killed the AAC encoder and the
dca, wmapro and atrac3 decoders. The affected versions generate correct
code at -O1, gcc 15 does so at any level.



>From 5ca9507a60d2abd1f41ad510432d12f21e82a509 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Fri, 16 Oct 2026 18:35:52 +0200
Subject: [PATCH] configure: build sh4 with -O1 for gcc before 15

At -O2 and above gcc 10 to 14 lose track of the FPSCR precision mode on
sh4 and execute fldi0 while double precision is selected, which traps
with an illegal instruction. In FATE this killed the AAC encoder and the
dca, wmapro and atrac3 decoders. The affected versions generate correct
code at -O1, gcc 15 does so at any level.
---
 configure | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure b/configure
index c97ddb186f..80f2cf640c 100755
--- a/configure
+++ b/configure
@@ -8019,6 +8019,11 @@ elif enabled gcc; then
             ;;
         esac
     fi
+    if test $arch = sh4 && [ $major_version -lt 15 ]; then
+        # At -O2 and above gcc loses track of the FPSCR precision mode and
+        # executes fldi0 in double precision mode, which traps.
+        check_optflags -O1
+    fi
     check_cflags -Werror=implicit-function-declaration
     check_cflags -Werror=missing-prototypes
     check_allcflags -Werror=format-security
-- 
2.54.0

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

Reply via email to