@@ -92,7 +92,7 @@ function compile(solvers, mexdir, fortd, gateways, options)
9292 % -ftrampoline-impl=heap instructs the compiler to put the trampolines on the heap instead of the
9393 % stack. This option is available since gcc/gfortran 14. Without this option, executable stacks
9494 % will be generated by the internal subroutines passed as actual arguments. This is related to
95- % a bug of MATLAB R2025a on Linux, which segfaults when handling Fortran MEX files with internal
95+ % a bug of MATLAB R2025a/b on Linux, which segfaults when handling Fortran MEX files with internal
9696 % procedures. For details, see the `support_internal_procedures` part below and
9797 % https://fortran-lang.discourse.group/t/implementation-of-a-parametrized-objective-function-without-using-module-variables-or-internal-subroutines/9919?u=zaikunzhang
9898 % First, get the major version of GCC corresponding to the libgcc used by the Fortran MEX.
@@ -153,7 +153,7 @@ function compile(solvers, mexdir, fortd, gateways, options)
153153
154154% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155155% Zaikun 20250720:
156- % The following code is to circumvent a bug in MATLAB R2025a, which segfaults on Linux when the
156+ % The following code is to circumvent a bug in MATLAB R2025a/b , which segfaults on Linux when the
157157% Fortran files contain internal procedures that are passed as actual arguments to other procedures,
158158% provided that the Fortran compiler is gfortran and the option -ftrampoline-impl=heap is not used.
159159% To avoid this bug, we replace gateways/*_mex.F90 with gateways/R2025a/*_mex.F90, and
@@ -165,13 +165,13 @@ function compile(solvers, mexdir, fortd, gateways, options)
165165% https://stackoverflow.com/questions/79699706/matlab-2025a-vs-fortran-mex-files-with-internal-subroutines
166166% https://fortran-lang.discourse.group/t/implementation-of-a-parametrized-objective-function-without-using-module-variables-or-internal-subroutines
167167% https://stackoverflow.com/questions/79705107/fortran-implementating-a-parametrized-objective-function-without-using-module-v
168- matlab_supports_ip = (isMATLABReleaseOlderThan(' R2025a' ) || ~isMATLABReleaseOlderThan(' R2025b ' ));
168+ matlab_supports_ip = (isMATLABReleaseOlderThan(' R2025a' ) || ~isMATLABReleaseOlderThan(' R2026a ' ));
169169compiler_supports_ip = (~contains(compiler_manufacturer , ' gnu' ) || contains(compiler_options , ' -ftrampoline-impl=heap' ));
170170support_internal_procedures = (matlab_supports_ip || compiler_supports_ip );
171171if ~support_internal_procedures
172172 if verbose
173173 warning(' prima:ThreadRecursionUnsafe' , ...
174- [' MATLAB R2025a has a bug that causes segmentation faults when handling Fortran MEX files with internal procedures.\n ' , ...
174+ [' MATLAB R2025a/b has a bug that causes segmentation faults when handling Fortran MEX files with internal procedures.\n ' , ...
175175 ' PRIMA is adapted to circumvent this bug but it becomes thread-unsafe and recursion-unsafe.' ]);
176176 end
177177 % Replace the files. N.B.: The .*90 files have become .* after the code refactoring in setup.m.
0 commit comments