forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Access Violation error after running a compiled program

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
mali28



Joined: 09 Feb 2017
Posts: 11

PostPosted: Mon Apr 10, 2017 2:24 pm    Post subject: Access Violation error after running a compiled program Reply with quote

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
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Mon Apr 10, 2017 2:40 pm    Post subject: Reply with quote

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 http://forums.silverfrost.com/viewtopic.php?t=3426&highlight=f0f0f0f0 . One may wonder if the same compiler bug is at play in both posts.


Last edited by mecej4 on Tue Apr 25, 2017 8:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5042
Location: Salford, UK

PostPosted: Mon Apr 10, 2017 2:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mali28



Joined: 09 Feb 2017
Posts: 11

PostPosted: Mon Apr 10, 2017 5:39 pm    Post subject: Reply with quote

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 give
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Mon Apr 10, 2017 7:52 pm    Post subject: Reply with quote

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 $<
Back to top
View user's profile Send private message
mali28



Joined: 09 Feb 2017
Posts: 11

PostPosted: Tue Apr 11, 2017 9:08 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Tue Apr 11, 2017 9:39 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mali28



Joined: 09 Feb 2017
Posts: 11

PostPosted: Tue Apr 11, 2017 11:04 am    Post subject: Reply with quote

Thank you for your reply. The code already has IMPLICIT NONE in each sub program.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Tue Apr 11, 2017 2:09 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group