Silverfrost Forums

Welcome to our forums

MAXVAL with /check-option

28 Feb 2024 8:56 #31158

I got an 'Access-Violation' error with MAXVAL ( or MINVAL) when I compile my code with the /check option (only 64bit). See the following example:

          program Test_maxval
          integer*4,parameter                :: size_1_of_array = 5
          integer*4,parameter                :: size_2_of_array = 10
          integer*4,parameter                :: max_ref = 10
          real*4                             :: r_maxval
          real*4,ALLOCATABLE,DIMENSION(:,:)  :: real_array
          integer*4                          :: i, ierror
          integer*4,dimension(max_ref)       :: n_points 

          ALLOCATE (real_array(size_1_of_array,size_2_of_array),STAT = ierror)
          real_array = 1.
          real_array(2,3) = 2.
          i = 3
          n_points = 4
          
          r_maxval = maxval(real_array(1:4,3))
                    
          write(*,*)'r_maxval=',r_maxval
          
          stop
          end
28 Feb 2024 9:28 #31160

Ralf

On first testing this does not fail for me. Which version of FTN95 are you using?

28 Feb 2024 9:54 #31161

Version 9.00.0 I compile the example with: ftn95 /check /64 testmaxval.f95 /link

28 Feb 2024 9:59 #31162

I am sorry, I posted the wrng version of the example. relplace the maxval command with:

          r_maxval = maxval(real_array(1:n_points(i),i))
28 Feb 2024 10:27 #31163

The bounds checking for 64 bits does not work in this context. For the moment it is necessary to add /inhibit_check 20 when using /check.

I will add this to the list of things to investigate.

12 Jun 2024 1:56 #31383

HI, I presume this is not fixed yet? Thanks

12 Jun 2024 2:43 #31385

That is correct. This is one of about 4 recently reported bugs that have not yet been fixed.

14 Jun 2024 10:17 #31386

MINVAL seems to have a similar problem in 64bits...

even if i set the /inhibit_check 20, when i come to run the following line, I get an Access violation trying to access address x0...048 in the MINVAL line.

     LE0     =  JE0-MIN(JE0,JE1)+1
     LE1     =  JE1-MIN(JE0,JE1)+1
 VVMIN	=  MINVAL(VDAT(LE0:LE1))
 VVMAX	=  MAXVAL(VDAT(LE0:LE1))

vdat is a 72-element array, LE0=1, LE1=72.

in this example, VDAT contains -9.9x10^20 and above it is the code to check it for valid data.

K

15 Jun 2024 6:08 #31387

Kenny

Thanks for the additional information. I will aim to take a took at this next week.

17 Jun 2024 7:40 #31388

Ralf

This failure has now been fixed for the next release of FTN95.

Kenny

From the information provided I have not been able to create a sample program that fails. If you are not using the latest release then it is possible that the failure has already been fixed. Otherwise the fix for Ralf is very likely to be the same issue.

Please login to reply.