- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having a problem with ALLOCATABLE arrays being used as arguments.
The situation:
SUBROUTINE PlotZahnrad(...)
USE qtSFD! see below
...
TYPE (qtSFD_T_RadPaarung), ALLOCATABLE :: tRadPaar(:), tPaarfolge(:)
LOGICAL, ALLOCATABLE :: laRadGezeichnet(:)
...
DO iRd = iRdS, iRdE
...
CALL qtSFD_S_BestimmeRadpaarungen( tRk, nRaeder, iAnzZahnauswahl, iaZahnauswahl, &
tRadPaar, tPaarfolge, laRadGezeichnet )
...
IF ( ALLOCATED(tRadPaar) ) DEALLOCATE(tRadPaar)
IF ( ALLOCATED(tPaarfolge) ) DEALLOCATE(tPaarfolge)
IF ( ALLOCATED(laRadGezeichnet) ) DEALLOCATE(laRadGezeichnet)
END DO
END SUBROUTINE PlotZahnrad
MODULE qtSFD
TYPE qtSFD_T_RadPaarung
INTEGER(qt_K_SHORT) iRad(2)
CHARACTER(16) cBez(2)
INTEGER iBewertung
LOGICAL lIgnore
INTEGER iFolge
INTEGER iZahnauswahl
INTEGER :: iTreibendesRad = 0
END TYPE qtSFD_T_RadPaarung
...
CONTAINS
SUBROUTINE qtSFD_S_BestimmeRadpaarungen( tRk, nRaeder, iAnzZahnauswahl, iaZahnauswahl, &
tRadPaar, tPaarfolge, laRadGezeichnet )
TYPE (qtSFD_T_Raederkette), INTENT(INOUT) :: tRk
INTEGER, INTENT(IN) ::nRaeder
INTEGER, INTENT(IN) :: iAnzZahnauswahl ! Anzahl Zahnauswahlvorgaben
INTEGER, INTENT(INOUT) :: iaZahnauswahl(iAnzZahnauswahl)
TYPE (qtSFD_T_RadPaarung), INTENT(OUT), ALLOCATABLE :: tRadPaar(:)
TYPE (qtSFD_T_RadPaarung), INTENT(OUT), ALLOCATABLE :: tPaarfolge(:)
LOGICAL, INTENT(OUT), ALLOCATABLE :: laRadGezeichnet(:)
...
END SUBROUTINE qtSFD_S_BestimmeRadpaarungen
END MODULE qtSFD
When PlotZahnrad(...) is being called and the do loop is run only once (iRdS = iRdE) then everything is fine.
However if I call PlotZahnrad(...) and iRdE > iRdS such that the do loop is run at least twice, the program
crashes when calling qtSFD_S_BestimmeRadpaarungen() in the second do loop round (the first one went fine). The
traceback tells me that there is an "access violation". In the debugger, the crash occurs exactly at the head
of the SUBROUTINE qtSFD_S_BestimmeRadpaarungen. It appears to me that there is a problem with the allocatable
array arguments.
So I have checked that the allocatable arrays are in fact de-allocated before the call of
qtSFD_S_BestimmeRadpaarungen(). I have also tried to run without "array boundary checks disabled" or I turned
on "AUTOMATIC variables". All in vain. I wonder what I am doing wrong. Or, is there a bug in the compiler? I am
still using v9.1.032. Does someone has an idea?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I were you I'd try to simplify the code down to the simplest case that reproduces the problem.
Gib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your advice, but this doesn't help me in this case.
I hoped that someone has had a similar problem and found a solution.
For example, telling me that I could get rid of that problem by updating to v10.1.
I am reluctant to this because I am afraid of running into other troubles and theextra work caused by the new installation and testing. So, I didn't try so far.
Joerg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You left out some critical parts - such as whether the allocatable variables are arguments to the outer routine. I'll guess they are not. I have seen various issues with local allocatable variables in the past, and if your program happens to run into one of these (I have no way to know for sure), you should find 10.1 an improvement.
![](/skins/images/2E08A100FB92911314A240D1EAFB2828/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