Silverfrost Forums

Welcome to our forums

Access Violation error after running a compiled program

10 Apr 2017 1:24 #19371

Hello,

I am trying to compile a Fortran program on Windows 7 using FTN95 compiler. The program compiles while there is no error, it gives me some warnings. The compiled exe program when I try to run it gives the following error:

Access Violation

The instruction at address 00410901 attempted to read from location f0f0f0f0

004108d4 FUNCTIONS!SORPTION [+002d] 0041a5c0 INITIALIZATION [+34c9] 00419660 START [+001f] 00401000 PARTICLEDRYING [+00cb]

I have no idea what this is and how to fix it. I would highly appreciate your help.

Thank you, MA

10 Apr 2017 1:40 (Edited: 25 Apr 2017 7:32) #19372

Your program has a bug. There is no general solution for bugs, but you can ask the compiler to help you find the bug.

If you compile and link with the /debug option, you may receive a traceback that will show you the line on which the error occurred. If the program source is not big -- say, a few hundred lines, and you provide it, one of the forum members here may help you with that.

You may also try the excellent checking facilities of FTN95, but be warned that if the source code is not properly written -- for examples, if array argument subscript bounds are not correctly specified -- you may receive a large number of 'errors', which can distract you from the quest to find the bugs that are more significant.

The address F0F0F0F0 is highly suspicious.

[Added April 25, 2017] Not only suspicious, but vaguely familiar! See https://forums.silverfrost.com/Forum/Topic/3034&highlight=f0f0f0f0 . One may wonder if the same compiler bug is at play in both posts.

10 Apr 2017 1:44 #19373

If you use one of the debugging options such as /DEBUG, /CHECK or /CHECKMATE then the error report should give you the line number in the code where the failure occurred. Using one of these options and running the executable from the debugger SDBG (or SDBG64) should take you to the line where the program fails.

If you can provide a short working program that illustrates the error then we will be able to provide more help.

Your report should say if it 32 bits, 64 bits or .NET. Also it often helps to know what operating system you are using.

10 Apr 2017 4:39 #19374

Thank you for your reply. I am new to fortran and I am not sure how to compile it with /debug option. I have a makefile, which I use to compile the program on Windows 7 64 bit using FTN95 compiler.

mk32 -f Makefile_ftn.mak

The following is what I get during compilation:

WARNING - Variable TRNSFRMD_RIGHT has been given a value but never used WARNING - Variable SHELLTRNSFRMD_LEFT has been given a value but never used WARNING - Variable SHELLTRNSFRMD_RIGHT has been given a value but never used WARNING - Variable TEST1 has been declared but not used 0365) REAL(DP) :: C_one_left_ute,C_one_right_ute WARNING - Variable C_ONE_LEFT_UTE has been declared but not used WARNING - Variable C_ONE_RIGHT_UTE has been declared but not used 0468) IF(uleft(ute).ne.uleft(ute))THEN WARNING - Comparing floating point quantities for inequality may give misleading results NO ERRORS, 13 WARNINGS [<NUMFLX> FTN95/Win32 v7.00.0] 0515) REAL(DP),INTENT(IN) :: vdot(ncode) WARNING - The argument VDOT has not been used 0530) REAL(DP) :: dudzL(npde),dudzR(npde),wrk(1:npts_in),& 0531) vel,DiffL,DiffR,SDiffL,SDiffR WARNING - Variable WRK has been declared but not used WARNING - Variable VEL has been declared but not used 0533) REAL(DP) :: Volume,sums(ute:mZe) WARNING - Variable VOLUME has been declared but not used WARNING - Variable SUMS has been declared but not used 0535) REAL(DP) :: temp(1:5),temp1,temp2,temp3,temp4,temp5,temp6,& 0536) temp7,temp8,temp9,temp10 WARNING - Variable TEMP1 has been declared but not used WARNING - Variable TEMP2 has been declared but not used WARNING - Variable TEMP3 has been declared but not used WARNING - Variable TEMP4 has been declared but not used WARNING - Variable TEMP5 has been declared but not used WARNING - Variable TEMP6 has been declared but not used 0537) REAL(DP) :: vs,v_cont,Sv_cont,v_disc,Sv_disc WARNING - Variable V_CONT has been declared but not used WARNING - Variable SV_CONT has been declared but not used WARNING - Variable SV_DISC has been given a value but never used 0538) REAL(DP) :: SBFluxIn,SBFluxOut,SBFluxInTest,SBFluxOutTest WARNING - Variable SBFLUXIN has been declared but not used WARNING - Variable SBFLUXOUT has been declared but not used WARNING - Variable SBFLUXINTEST has been declared but not used WARNING - Variable SBFLUXOUTTEST has been declared but not used 0539) REAL(DP) :: SolidsDiff,v_bub,test_out,avL,NumD,Yws_S,Yws_R,Yws WARNING - Variable AVL has been declared but not used WARNING - Variable NUMD has been declared but not used 0540) REAL(DP) :: rho_air,AirDiff,Perm,Pbuck,Ppseud,Length WARNING - Variable PERM has been declared but not used WARNING - Variable PBUCK has been declared but not used WARNING - Variable PPSEUD has been declared but not used WARNING - Variable LENGTH has been declared but not used 0541) INTEGER(I4B) :: i,j,bndopt WARNING - Variable J has been declared but not used 0542) LOGICAL(LGT) :: abort,testlgt,ExtShellFormed WARNING - Variable ABORT has been declared but not used WARNING - Variable TESTLGT has been declared but not used 0651) IF((u(svf,npts).ge.MaxSolVolFrac).and. .NOT.(ShellFormed).and.& 0652) (u(svf,npts)-u(svf,npts-1)).ne.& 0653) (u(svf,npts-1)-u(svf,npts-2)))THEN WARNING - Comparing floating point quantities for inequality may give misleading results 0748) IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed 0834) IF(.true.)THEN COMMENT - This IF statement is redundant as it will always succeed 1021) IF(u(5,101).ne.u(5,101))THEN WARNING - Comparing floating point quantities for inequality may give misleading results NO ERRORS, 29 WARNINGS, 2 COMMENTS [<BNDARY> FTN95/Win32 v7.00.0] 1064) REAL(DP),INTENT(IN) :: xi(nxi) WARNING - The argument XI has not been used 1073) REAL(DP),INTENT(IN) :: ucpt(npde,nxi) WARNING - The argument UCPT has not been used 1083) REAL(DP) :: SDiffL,SDiffR,DiffL,DiffR,vel,rho_cL,rho_cR,& 1084) Srho_cL,Srho_cR,G,C_one,zeta WARNING - Variable SDIFFL has been given a value but never used WARNING - Variable SDIFFR has been given a value but never used WARNING - Variable DIFFL has been given a value but never used WARNING - Variable DIFFR has been given a value but never used WARNING - Variable VEL has been declared but not used WARNING - Variable G has been declared but not used WARNING - Variable C_ONE has been declared but not used WARNING - Variable ZETA has been declared but not used 1085) REAL(DP) :: temp,chi,mVap,drop_cp,mFlux,QFlux,mLost WARNING - Variable TEMP has been declared but not used WARNING - Variable CHI has been declared but not used WARNING - Variable QFLUX has been given a value but never used WARNING - Variable MLOST has been declared but not used 1086) REAL(DP) :: trnsfrmd,thcknss,Sthcknss WARNING - Variable TRNSFRMD has been declared but not used WARNING - Variable THCKNSS has been given a value but never used 1088) REAL(DP) :: SBFluxIn,SBFluxOut,SolidsVolFlux,Contvel,test_out,& 1089) SolidsDiff,Yws WARNING - Variable SBFLUXIN has been declared but not used WARNING - Variable SBFLUXOUT has been declared but not used WARNING - Variable SOLIDSVOLFLUX has been declared but not used WARNING - Variable CONTVEL has been declared but not used 1203) IF((Pbuck.ge.Ppseud).and.(v(8).ne.zero).and.& 1204) ! IF((Pbuck.le.Ppseud).and.(v(8).ne.zero).and.& 1205) (Ppseud.ge.zero).and.(Pbuck.ge.zero))THEN WARNING - Comparing floating point quantities for inequality may give misleading results 1231) IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed 1320) IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed 1349) IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed 1393) IF(ucp(ute,nxi).ne.ucp(ute,nxi))THEN WARNING - Comparing floating point quantities for inequality may give misleading results NO ERRORS, 22 WARNINGS, 3 COMMENTS [<ODEDEF> FTN95/Win32 v7.00.0] 1412) REAL(DP),OPTIONAL,INTENT(IN) :: wat_frac,ute_frac,svf,wat_grad,& 1413) ute_grad,svf_grad,vap_frac,T WARNING - The argument SVF_GRAD has not been used 1415) REAL(DP) :: A_frac,B_frac,A_grad,B_grad,vap WARNING - Variable A_GRAD has been given a value but never used WARNING - Variable B_GRAD has been given a value but never used NO ERRORS, 3 WARNINGS [<VAR_CALC> FTN95/Win32 v7.00.0] NO ERRORS [<NAG_PDE> FTN95/Win32 v7.00.0] ftn95 /FREE_FORMAT /WIDE_SOURCE Profile_Update [FTN95/Win32 Ver. 7.00.0 Copyright (c) Silverfrost Ltd 1993-2013] Licensed to: Site Licence Organisation: UNIVERSITY OF LEEDS

  1. REAL(DP),INTENT(IN) :: Tdrop WARNING - The argument TDROP has not been used

  2. INTEGER(I4B) :: i,it,num_jac_eval,num_resid_eval,num_time_iter,&

  3. num_time_step,loops WARNING - Variable I has been declared but not used WARNING - Variable IT has been declared but not used WARNING - Variable NUM_JAC_EVAL has been declared but not used WARNING - Variable NUM_RESID_EVAL has been declared but not used WARNING - Variable NUM_TIME_ITER has been declared but not used WARNING - Variable NUM_TIME_STEP has been declared but not used

  4. LOGICAL(LGT) :: first_call,WriteSuccessFlag WARNING - Variable FIRST_CALL has been given a value but never used WARNING - Variable WRITESUCCESSFLAG has been declared but not used

  5. LOGICAL(LGT) :: wrk_lgt(npde,npts_in) WARNING - Variable WRK_LGT has been given a value but never used

  6. LOGICAL(LGT) :: abort ! restart timestep if abort is set to true WARNING - Variable ABORT has been declared but not used

  7. REAL(DP),DIMENSION(1:npts_in) :: A_profile,B_profile,D_profile WARNING - Variable A_PROFILE has been declared but not used WARNING - Variable B_PROFILE has been declared but not used WARNING - Variable D_PROFILE has been declared but not used

  8. REAL(DP) :: Q,b,R,test_out,Yws WARNING - Variable B has been declared but not used

  9. IF((ifail.ne.0.).and.(ifail.ne.6).and.(.NOT.(DryShellSwitch))) THEN WARNING - Comparing floating point quantities for inequality may give misleading results NO ERRORS, 16 WARNINGS [<PROFILEUPDATE> FTN95/Win32 v7.00.0]

  10. IF(t_remain.eq.0) THEN WARNING - Comparing floating point quantities for equality may give misleading results

  11. IF(t_remain.eq.0) THEN WARNING - Comparing floating point quantities for equality may give misleading results NO ERRORS, 2 WARNINGS [<ADJUSTTIMESTEP> FTN95/Win32 v7.00.0]

  12. ELSE IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed

  13. ELSE IF(.true.) THEN COMMENT - This IF statement is redundant as it will always succeed

  14. ELSE IF(.false.) THEN COMMENT - This IF statement is redundant as it will never succeed

  15. ELSE IF(.false.) THEN ! COMMENT - This IF statement is redundant as it will never succeed

  16. ELSE IF(.false.) THEN COMMENT - This IF statement is redundant as it will never succeed

  17. ELSE IF(.false.) THEN COMMENT - This IF statement is redundant as it will never succeed NO ERRORS, 6 COMMENTS [<CONSTRUCTGRID> FTN95/Win32 v7.00.0] ftn95 /FREE_FORMAT /WIDE_SOURCE DryingMain [FTN95/Win32 Ver. 7.00.0 Copyright (c) Silverfrost Ltd 1993-2013] Licensed to: Site Licence Organisation: UNIVERSITY OF LEEDS

  18. REAL(DP) :: b,R,hx,dt,mean_B_R,bStore,RStore,TStore WARNING - Variable R has been declared but not used WARNING - Variable HX has been declared but not used WARNING - Variable MEAN_B_R has been declared but not used

  19. INTEGER(I4B) :: i,j,k,time_loop,err,int_counter WARNING - Variable J has been declared but not used WARNING - Variable K has been declared but not used WARNING - Variable TIME_LOOP has been declared but not used WARNING - Variable ERR has been declared but not used

  20. REAL(DP) :: tslo ! time since the last output WARNING - Variable TSLO has been given a value but never used

  21. REAL(DP) :: temp(1:3) WARNING - Variable TEMP has been declared but not used

  22. REAL(DP) :: rho_c,S_old WARNING - Variable S_OLD has been declared but not used

  23. REAL(DP) :: mVap,mFlux,Q,Yws,test_out,Psi WARNING - Variable MVAP has been declared but not used WARNING - Variable MFLUX has been declared but not used WARNING - Variable Q has been declared but not used WARNING - Variable YWS has been declared but not used WARNING - Variable TEST_OUT has been declared but not used WARNING - Variable PSI has been declared but not used NO ERRORS, 16 WARNINGS [<PARTICLEDRYING> FTN95/Win32 v7.00.0]

  24. REAL(DP),INTENT(IN) :: grid_in(:),grid_out(:),profiles(:,:),R,P,T WARNING - The argument R has not been used

  25. REAL(DP) :: dr,Volume,MomZero,VapDen WARNING - Variable DR has been declared but not used NO ERRORS, 2 WARNINGS [<MASSTEST> FTN95/Win32 v7.00.0]

  26. REAL(DP) :: dr,Volume WARNING - Variable DR has been declared but not used

  27. REAL(DP) :: Moments(1:3,1:npts_in-1) WARNING - Variable MOMENTS has been given a value but never used

  28. REAL(DP) :: TotalComponentMasses_new(1:3) WARNING - Variable TOTALCOMPONENTMASSES_NEW has been given a value but never used

  29. REAL(DP) :: TotalMass_old(1:npts_in-1),TotalMass_new(1:npts_in-1) WARNING - Variable TOTALMASS_OLD has been declared but not used WARNING - Variable TOTALMASS_NEW has been declared but not used

  30. REAL(DP) :: TotalMassFractions(1:3,1:npts_in-1) WARNING - Variable TOTALMASSFRACTIONS has been declared but not used

  31. REAL(DP) :: uteVolFrac(1:npts_in) WARNING - Variable UTEVOLFRAC has been given a value but never used

  32. REAL(DP) :: OldVolume,NewVolume WARNING - Variable OLDVOLUME has been given a value but never used WARNING - Variable NEWVOLUME has been given a value but never used

  33. REAL(DP) :: MissingSoluteMass,MissingSolventMass,MakeUp WARNING - Variable MAKEUP has been given a value but never used

  34. REAL(DP) :: BubbleAmount WARNING - Variable BUBBLEAMOUNT has been declared but not used

  35. IF(.false.)THEN ! This definitely doesn't work COMMENT - This IF statement is redundant as it will never succeed

  36. IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed

  37. IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed

  38. IF(.false.)THEN COMMENT - This IF statement is redundant as it will never succeed

  39. IF(.true.)THEN COMMENT - This IF statement is redundant as it will always succeed NO ERRORS, 11 WARNINGS, 5 COMMENTS [<PROFILE_CORRECTION> FTN95/Win32 v7.00. 0]

  40. REAL(DP),INTENT(IN) :: b,startstep_R,endstep_R,&

  41. ComponentMasses(1:3),TotalVolume,VChange,VEvap,MassChange(1:3),&

  42. t,Moments(1:3) WARNING - The argument B has not been used WARNING - The argument STARTSTEP_R has not been used WARNING - The argument ENDSTEP_R has not been used WARNING - The argument TOTALVOLUME has not been used WARNING - The argument VCHANGE has not been used WARNING - The argument VEVAP has not been used WARNING - The argument MASSCHANGE has not been used NO ERRORS, 7 WARNINGS [<WRITEMASSES> FTN95/Win32 v7.00.0] slink linkscript.lnk $ lo DryingMain [SLINK/Win32 v1.45 Copyright (c) Silverfrost Ltd. 1995-2013] $ lo NR_Modules.obj $ lo Modules.obj $ lo Physical_Properties.obj $ lo Interfaces.obj WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\Interfaces.obj) $ lo nr_library.obj WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\nr_library.obj) $ lo Transport_Processes.obj $ lo Basic_Functions.obj WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\Basic_Functions.obj) WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\Basic_Functions.obj) WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\Basic_Functions.obj) WARNING - Module component SORT_HEAP has been defined differently here than prev iously in object file C:\Users\.....\Desktop\src_drying_jhp\DryingMain.obj (C:\Users\.....\Desktop\src_drying_jhp\Basic_Functions.obj) $ lo ReadOptions.obj $ lo WriteData.obj $ lo Initialization.obj $ lo Profile_Update.obj $ lo NAG_PDE_Modules.obj $ file WARNING the following symbols are missing: E02BBF C:\Users\.....\Desktop\src_drying_jhp\Initialization.obj (C:\USERS\.....\DESKTOP\SRC_DRYIN G_JHP\INITIALIZATION.F90) E02BEF C:\Users\.....\Desktop\src_drying_jhp\Initialization.obj (C:\USERS\.....\DESKTOP\SRC_DRYIN G_JHP\INITIALIZATION.F90) D03PLF C:\Users\.....\Desktop\src_drying_jhp\Profile_Update.obj (C:\USERS\.....\DESKTOP\SRC_DRYIN G_JHP\PROFILE_UPDATE.F90) Creating executable: C:\Users\.....\Desktop\src_drying_jhp\DryingMain.exe

10 Apr 2017 6:52 #19376

Those warning message give us no useful information unless the source code is also made available.

You exceeded the line limit for posts, as you can see by the missing tail end of the messages.

If you are building with Make, you have to add /debug to the implicit rule for making object files from source files. For example:

.f.obj: <tab> ftn95 /debug /check $<

11 Apr 2017 8:08 #19383

Thank you for this information. I am now getting the following error upon running the compiled file:

Run-time Error

Attempt to call a routine with argument number one as a logical (kind=3) when integer(kind=3) was required

READOPTIONS - in file readoptions.f90 at line 711 [+0044] main - in file dryingmain.f90 at line 72 [+00a9]

The file readoptions.f90 only has 180 lines of code. dryingmain.f90 has readoptions function but it doesn't contain the definition of variable type there.

11 Apr 2017 8:39 #19385

The compiler has added checking code, and those checks may have told you the exact error: there is a mismatch between the types of the actual arguments and the dummy arguments. Probably, you left out a type declaration of the dummy argument in the subroutine and the implicit type is INTEGER.

Adding IMPLICIT NONE to each subprogram will help you to catch such errors at compile time rather than run time.

11 Apr 2017 10:04 #19387

Thank you for your reply. The code already has IMPLICIT NONE in each sub program.

11 Apr 2017 1:09 #19391

In that case, you have to compare the subroutine call with the subroutine interface (explicit or implicit, as the case may be) for consistency. Without seeing the source code, no further comment can be made about that point.

Please login to reply.