Description: Fix OpenMP data race when computing the firpm filter coefficients
 The final inverse-DFT loop which turns the estimated amplitude response into
 the filter impulse response is annotated with "#pragma omp parallel for", but
 its accumulation variable (s) and its inner-loop counter (j) are declared
 outside of the loop and are therefore shared by all OpenMP threads.
 Octave builds with OpenMP support (mkoctfile passes -fopenmp, so _OPENMP is
 defined), which makes the resulting data race corrupt the returned filter
 coefficients; the minimax error value (which is computed before this loop)
 is not affected.  This race caused the upstream test suite failures in
 src/firpm.cc (all failing assertions compare filter coefficients, while every
 minimax assertion passed).  Declaring both variables inside the loop body
 gives each thread its own copy, restoring deterministic and correct results.
Author: openKylinBot <openKylinBot@openkylin.top>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-09-21

--- octave-signal-1.4.7.orig/src/mmfir.c
+++ octave-signal-1.4.7/src/mmfir.c
@@ -663,7 +663,7 @@ MmfirReport mmfir(
 
   { // Generate filter coefficients:
     double * a = (double *)prevPeaks; // Reuse, as it's no longer in use.
-    double _1 = T>TypeII? -1:1, phi = (T<TypeIII)*.5, s;
+    double _1 = T>TypeII? -1:1, phi = (T<TypeIII)*.5;
 
     // Sample the final estimated response; modify for filter type:
     #ifdef _OPENMP
@@ -681,6 +681,8 @@ MmfirReport mmfir(
     #pragma omp parallel for
     #endif
     for (i=0; i <(N+1)/2; ++i) {
+      double s; // Local, so that omp threads each get a private copy.
+      int j;    // Ditto (omp needs a separate counter here).
       for (s=*a*.5, j=1; j <= N/2; s += sin(PI*((N-1-2.*i)/N*j+phi))*a[j], ++j);
       h[i] = _1*(h[N-1-i] = 2*s/N);
     }
