Warning:Windows 11 24H2
Please be aware that (in the UK at least) automatic updates for Windows 11 now give you version 24H2.
Win32 applications that contain calculations that underflow will currently not recover unless underflows are masked.
This only applies to Win32 applications, not x64 and not .NET.
Win32 underflows can be masked by either:
- calling mask_underflows@() or
- setting the environment variable SALFENVAR=mask_underflows
This applies for all versions of salflibc.dll prior to FTN95 v9.10.
Can I ask what is the likely result of a program not recovering from underflow? Is seizing up a likely result?
Seizing up is exactly what happens if you take an underflow in Win32. FTN95 9.10 and above turn off underflow trapping to stop this.
You can expect the program to fail at runtime. It will terminate and display an error report.
The problem was caused by a change in the Windows operating system that affected Win32 FTN95 programs (not x64 and not .NET).
You should use a recent release of FTN95 or make the changes described above.
Just to be 100% clear, for Windows 11 and 32 bit programs
If I use an older version of SALFLIBC.DLL then it will be necessary to recompile with a call to mask_underflow@() (presumably added near the start of the program?)
On the other hand if I use the most recent version of SALFLIBC.DLL then it will NOT be necessary to recompile with an added call to mask_underflow@()
If I compile a 64 bit version then this is not an issue, regardless of the version of SALFLIBC.DLL
Thanks Louis
Louis
Your summary is correct.
A further question If running Windows 10 and using FTN95 ver 9.2, I add a call at the start of the program to mask_underflows@(), it then fails with an access violation when it encounters an underflow.
If on the other hand I use a call to permit_underflow@(permission) with permisission set to .true. then there is no issue and program runs OK
Is this the expected behaviour ?
Louis
If you are running Windows 10 on a Win32 platform then underflows are unmasked by default. It should not be necessary to make any changes such as calling mask_underflows@.
However, a call to mask_underflows@() should prevent an underflow exception from being raised. An access violation due to underflow should not happen.
Calling permit_underflow@(.TRUE.) is expected to be the same as a call to mask_underflows@().
If the failure message did indeed relate to an underflow exception and you now have something that works then just use what works for you.
Dear Paul I'm trying to debug an issue relating to Windows 11 and underflows. A colleague who is using my 32 bit compiled program on Windows 11 and compiled with FTN95 9.2 (using SALFLIBC.DLL ver 27.12.5.9) reports that the program halts with run-time error message "Floating point arithmetic underflow"
My understanding from the forum is that with Windows 11 and the latest versions of FTN95, this issue was now solved, but it appears not to be. I purchased an update for FTN95 9.2 especially to sort this issue out, so am somewhat frustrated.
The code does not contain ANY calls to mask_underflows or permit_underflows and it all worked fine under Windows 10 and previous versions of Windows. Even if calls to mask_underflows or permit_underflows are added, it still fails with the same run-time error. Unfortunately I personally don't have a Windows 11 machine at hand to check this out.
The access violation under windows 10 with FTN95 9.2 (using SALFLIBC.DLL ver 27.12.5.9) happens when a call to mask_underflows@ is added. If permit_underflow@(.TRUE.) is used instead there is no issue. I can supply the full code by email (~ 2000 lines)
You don't say which version of Windows 11.
Are there different issues with different versions of Windows 11?? This is a nightmare. I assumed that versions prior to 24H2 behaved in exactly the same way as earlier versions of Windows and with this new update the default meant that underflows now caused run time error. That's exactly whats happening with this Windows 11, which I believe is a Brazilian version, but I will have to check with my colleague.
Yes, anything prior to 24H2 is okay. I had a brand new laptop recently and it took a month before it decided to update past 24H1.
The colleague who reported that the FTN95 version 9.2 executable is still giving a run-time error with underflows is using Windows 11 version 25H2. Perhaps there is a new issue with this Windows Update that FTN95 version 9.2 does not solve?
Please confirm that your colleague is using the Win32 platform together with the Salflibc.dll that is shipped with FTN95 v9.2.
Also is there a reason why you are using the Win32 platform rather than x64?
Paul Yes the user is definitely using a Win32 executable with the SALFLIBC.DLL version that which comes with 9.2, i.e. 27.12.5.9 No reason other than laziness about moving to 64-bit executable. So far the Win32 executable had been no problem. Program is very large with multiple sources, but I am now working on building a 64-bit version.
Louis
The quickest way to resolve this issue is probably to change to x64.
