@@ -63,8 +63,8 @@ function compile(solvers, mexdir, fortd, gateways, options)
6363
6464% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6565% Zaikun 20250720:
66- % The following code is to circumvent a bug in MATLAB R2025a, which segfaults when the Fortran
67- % files contain internal procedures that are passed as actual arguments to other procedures.
66+ % The following code is to circumvent a bug in MATLAB R2025a, which segfaults on Linux when the
67+ % Fortran files contain internal procedures that are passed as actual arguments to other procedures.
6868% To avoid this bug, we replace gateways/*_mex.F90 with gateways/R2025a/*_mex.F90, and
6969% fortran/cobylb.f90 with gateways/R2025a/cobylb.f90, which uses module variables instead of
7070% internal procedures. The price is that PRIMA becomes thread-unsafe and recursion-unsafe.
@@ -74,7 +74,7 @@ function compile(solvers, mexdir, fortd, gateways, options)
7474% https://fortran-lang.discourse.group/t/implementation-of-a-parametrized-objective-function-without-using-module-variables-or-internal-subroutines
7575% https://stackoverflow.com/questions/79705107/fortran-implementating-a-parametrized-objective-function-without-using-module-v
7676
77- if verLessThan(' matlab' , ' 25.2' ) && ~verLessThan(' matlab' , ' 25.1' ) % The version number of R2025a is 25.1.
77+ if isunix && ~ ismac && verLessThan(' matlab' , ' 25.2' ) && ~verLessThan(' matlab' , ' 25.1' ) % The version number of R2025a is 25.1.
7878 if verbose
7979 warning(' prima:ThreadRecursionUnsafe' , ...
8080 [' MATLAB R2025a has a bug that causes segmentation faults when handling Fortran MEX files with internal procedures.\n ' , ...
0 commit comments