- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the following error when subroutine CRACK1 is called:
forrtl: severe (157): Program Exception - access violation
For instance in the subroutine when PS1 < 0, only echo1 is displayed and then the code runs into the error.
SUBROUTINE CRACK1(SIGL_, SIGT_, TAULT_, CRACK_)
IMPLICIT NONE
! Precision constants
DOUBLE PRECISION SIGL_, SIGT_, TAULT_, PS1
INTEGER CRACK_
! Compute the maximum principle stress
PS1 = (SIGL_ + SIGT_) / 2.D0 + SQRT((SIGL_ - SIGT_) **2.D0/4.D0
& + TAULT_ ** 2.D0)
! No tensile strength for concrete
IF (PS1.GT.0.D0) THEN
CRACK_ = 1
ELSE
print*, 'echo1'
CRACK_ = 0
print*, 'echo2'
END IF
RETURN
END SUBROUTINE CRACK1
The problem occurred for all optimization levels (32 bit) and for checking out of bounds by /check:bounds, I got:
forrtl: severe (408): fort: (4): Variable
which is greater than the variable length of 2
Any comment would be very much appreciated.
Hamid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error occurs at the assignment:
CRACK_ = 1
in routine CRACK1. This argument comes from a call in routine ESPR2_ESPR1 where it is called CRACK_, and this in turn comes from a call in routine VATS where the argument is named CRACK. CRACK is not otherwise declared, so since it is the name of a module procedure, the routine CRACK gets passed. In the end, you are trying to store a value of 1 in a routine and this triggers the access violation.
I don't find that removing D2R changes the behavior.
You'll have to figure out what you intend the program to do here. If CRACK in VATS is meant to be a variable, it needs to be declared in that routine with the correct type. Or maybe it is supposed to be CRACK_ in VATS as well (but not declared in the source you showed.)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for this. The code has 18k lines and works in conjunction with a commercial engineering software. Im trying to get its self-contained test, but can now post the subroutine from which CRACK1 is called if you think it may help.
Hamid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You don't show the traceback - how do you know the error occurs in this routine?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error occurs at the assignment:
CRACK_ = 1
in routine CRACK1. This argument comes from a call in routine ESPR2_ESPR1 where it is called CRACK_, and this in turn comes from a call in routine VATS where the argument is named CRACK. CRACK is not otherwise declared, so since it is the name of a module procedure, the routine CRACK gets passed. In the end, you are trying to store a value of 1 in a routine and this triggers the access violation.
I don't find that removing D2R changes the behavior.
You'll have to figure out what you intend the program to do here. If CRACK in VATS is meant to be a variable, it needs to be declared in that routine with the correct type. Or maybe it is supposed to be CRACK_ in VATS as well (but not declared in the source you showed.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CRACK_ is defined as INTEGER in subroutine EPSR2_EPSR1, which calls CRACK1. Looking back at subroutine VATS which calls EPSR2_EPSR1, the corresponding argument in the argument list of the call is CRACK. But CRACK is not defined as INTEGER in this routine and the Compaq compiler does not flag this, even though you have IMPLICIT NONE. If you add CRACK on to the INTEGER specification list (shown in bold italic below), your problem goes away.
I note that you have a FUNCTION called CRACK. It may just be co-incidence, but I would avoid this as it could lead to misunderstandings elsewhere, although it may not be the cause of what happened!
!*************************************************************************!
! SUBROUTINE: VATS !
!*************************************************************************!
SUBROUTINE VATS(EPSDPER, EPSDMAX, EPSLPER, EPSTPER, A,
& EPSLO, EPSUP, EPSD_, ERS, ERA, ITER, IMAX1, AMFP1, ROL_, ROT_,EC,
& ESL, EST, SIGT_, SIGL_, TAULT_, FN, ERF, EPSL_,EPST_,ALPHA,EPSYL,
& EPSYT, FYL, FYT, EPSR_, EPRSL, EPRST, EPSL1, EPST1, EPSL2, EPST2,
& EPSLP1, EPSTP1, EPSLP2, EPSTP2, FLP1, FLP2, EPSLP4, FLP4, STEP,
& FL, FT, ANALYS, STAB, SIGR, IMAX3, ERALPHA, EREPSR, EC1,
& FCR, EPSCR, CNL, BT, IMAX4, TPS, CT, FPRC, EPSPRC, TS1,
& SIGN_EPSD, EPSRPER)
IMPLICIT NONE
! Precision constants
DOUBLE PRECISION EPSDPER, EPSDMAX, EPSLPER, EPSTPER, EPSLO, EPSUP,
& EPSD_, ERS, ERA, AMFP1, ROL_, ROT_,EC,ESL,EST,SIGT_,SIGL_,TAULT_,
& ERF, EPSL_, EPST_, FLO, FUP, USQRT, EPSDOLD, FR, TEST,
& ALPHA,EPSYL, EPSYT, FYL, FYT, EPSR_, EPRSL, EPRST, SIGLEQ,SIGTEQ,
& ESLEQ, ESTEQ, EPSL1, EPST1, EPSL2, EPST2, EPSLP1, EPSTP1, EPSLP2,
& EPSTP2, FLP1, FLP2, EPSLP4, FLP4, FL, FT, TEMP, SIGR,
& EPSROLD, ALPHAOLD, ERALPHA, EREPSR, EC1, FCR, EPSCR, SIGTTEMP,
& SIGLTEMP, TAULTTEMP, EPSDMAXTEMP, EPSDPERTEMP,
& EPSR1, EPSR2, DEFALPHA, ALPHA1, ALPHA2, PI, ALPHALO, ALPHAUP,
& ALPHA_A, ERA1, DEFEPSR,
& EPSRLO, EPSRUP, EPSR_A, ERA2, FPRC, EPSPRC, DEFEPSR_TEMP, EPSRPER
INTEGER A, ITER, IMAX1, FN, IMAX, IL, IU, STEP, SWAP, ANALYS,
& STAB, IMAX3, ANALYSTEMP, CNL, BT, ITER1, SIGN, SIGN1, CRACK,
& ITER2, IMAX4, IMAXTEMP, TPS, CT, TS1, SIGN2, SIGN_EPSD, EPSR_JUMP
print*, 'VATS/1'
! Calculate DEFEPSR
CALL EPSR2_EPSR1(EPSDPER, EPSDMAX, EPSLPER, EPSTPER, EPSLO,
& EPSUP, EPSD_, ERS, ERA, AMFP1, ROL_, ROT_,EC,ESL,EST,SIGT_,SIGL_,
& TAULT_, ERF, EPSL_, EPST_, FR, ALPHA, EPSYL, EPSYT,FYL,FYT,EPSR_,
& EPRSL, EPRST, EPSL1, EPST1, EPSL2, EPST2, EPSLP1, EPSTP1, EPSLP2,
& EPSTP2, FLP1, FLP2, EPSLP4, FLP4, FL, FT, SIGR, ERALPHA, EREPSR,
& EC1, FCR, EPSCR, SIGTTEMP, SIGLTEMP, TAULTTEMP, EPSR1, EPSR2,
& DEFEPSR, ALPHA_A, ERA1, A, ITER, IMAX1, FN, IMAX, ANALYS, STAB,
& IMAX3, CRACK, CNL, BT, ITER1, TPS, CT, FPRC, EPSPRC, SIGN2,
& SIGN_EPSD, EPSRPER, EPSR_JUMP)
print*, 'VATS/2'
RETURN
END SUBROUTINE VATS
(posted before seeing Steve's reply)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im very impressed how fast you can debug programs!
Yes CRACK in EPSR2_EPSR1 shouldve been CRACK_ which needs declaration in VATS as you said and Anthony noticed as well.
Much appreciated to all the comments.
Hamid
![](/skins/images/3344F5B3B76C91485ED0E980FD0CA95E/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page