 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
IanLambley
Joined: 17 Dec 2006 Posts: 510 Location: Sunderland
|
Posted: Mon Dec 07, 2009 8:34 pm Post subject: |
|
|
How about adding a /debug |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Tue Dec 08, 2009 12:43 am Post subject: |
|
|
Ian,
I tried including /debug, but no change.
Just to check, I tried another small program example with /check, then SDBG and it started perfectly with the fortran code window, so I'm not sure why this example above starts with the assembler code window.
Does anyone know why this occurs ?
John
PS : It's also a pain that the module "interfaces" can not be used in SUB4. If it was, then we could have a module interfaces, which declares the interface for all subroutines and functions used in a program. This could then be used by the compiler to check for errors in argument lists for all uses of each routine. Otherwise there is never any checking that the INTERFACE defined is the same as in the coded routine. We still have 2 seperate definitions of the interface, which is a major deficiency in the INTERFACE concept in Fortran. |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 510 Location: Sunderland
|
Posted: Tue Dec 08, 2009 8:19 pm Post subject: |
|
|
John,
Create a separate .f95 file containing the module and interface data. Compile it to produce the all_data.mod
Compile and link the main code part.
SDBG then opens the code window.
I don't see why this should be the case, - is it an error?
Ian |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Thu Feb 04, 2010 12:26 pm Post subject: |
|
|
Paul,
Any chance of a fix to this error : "array sections not working with /check, for some types of arrays" to be included in the next release.
This has been an annoying bug to me for many years.
John |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Fri Feb 05, 2010 11:58 am Post subject: |
|
|
Sorry but this bug is still outstanding.
Thank you for reminding me.
The current work around is to add /inhibit_check 5. |
|
Back to top |
|
 |
lgriffiths
Joined: 09 Feb 2010 Posts: 3
|
Posted: Wed Feb 10, 2010 12:19 pm Post subject: |
|
|
Hi,
In regards to the error:
"Attempt to call a routine with argument number XX containing too few array elements" when using \check
I've been getting the same error. Lets say when program main calls subroutine SubA which calls subroutine SubB. With arrayx being passed to each. Arrayx initially declared in Program Main. Also, Subroutine SubB recieves some truncated version of arrayx (in my case one dimension less)
I.e.
Program main
bla bla
CALL subA(arrayx(:,:),n1,n2)
End Program main
Subroutine SubA
bla bla
CALL subB(arrayx(i1:i2,1),n) !ERROR
End subroutine SubA
a work around is to call subB as:
CALL subB(arrax(i1:i2,1:1),n)
For me this causes the error to go away. I have no idea why, but hope it helps.
Laurence _________________ Well, Blimey! Lets have another go at it... Yeah! |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Thu Apr 22, 2010 1:39 am Post subject: |
|
|
Paul,
Lately I've been using /check more often and this error keeps coming up. The length of the array section is not being correctly transferred, but if I step up the stack in the debugger, all the info is available in the array with the correct dimension, although I assume the problem is that /check says the supplied array is not 4 long. I've cut the following example from my code.
Code: |
INTEGER*4 SEC_TYPE, UPROP(13)
REAL*8 TPROP(13)
!
tprop = 0
tprop(9:10) = .100
tprop(11:12) = .005
call SECTION_PROP (SEC_TYPE, TPROP, UPROP)
end
SUBROUTINE SECTION_PROP (SEC_TYPE, TPROP, UPROP)
!
! calculate section properties for generic section type
!
INTEGER*4 SEC_TYPE, UPROP(13), I
REAL*8 TPROP(13)
real*8 angle_props(9)
!
call get_angle_props (tprop(9:12), angle_props)
!
100 RETURN
!
END SUBROUTINE SECTION_PROP
subroutine get_angle_props (dimen, props)
!
! calculate the properties of an (un)equal angle
!
real*8 dimen(4), props(9)
REAL*8 AX,AY,AZ, B,D,T,W, B1,D1
!
!--- CHECK IF GIVEN AS A SECTION TYPE
!
D = dimen(1)
B = dimen(2)
T = dimen(3)
W = dimen(4)
!
D1 = D-T
B1 = B-W
!
! Area
AX = D*W + B1*T
AY = D*W
AZ = B*T
!
props(1) = ax ! ax
RETURN
END
|
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Thu Apr 22, 2010 8:46 am Post subject: |
|
|
Thanks. The bug is still outstanding and I hope to have it fixed before too long. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Wed Jul 21, 2010 7:13 am Post subject: |
|
|
Sorry for the delay in getting back to you on this bug.
Having finally revisited the problem I find that the bug has been reported elsewhere and is now fixed. The fix will in the next release. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Wed Jul 21, 2010 7:46 am Post subject: |
|
|
Paul,
That is great news. I will be keen to get the update and get past this point.
I have had to avoid /check for these routines. Can you give any summary as to why these arrays lost their size attribute?
John |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Wed Jul 21, 2010 8:26 am Post subject: |
|
|
As I understand it, the size attribute was not lost (is there evidence that it was?).
Run time checking of array sizes turns out to be very difficult (maybe impossible with the current design for runtime checking) for array sections of varying size. The fix is to switch off this aspect of /check in this particular case. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Wed Jul 21, 2010 8:56 am Post subject: |
|
|
Paul,
I thought it was lost, but now it is found ?? If you take the example I provided above and compile with /check and step in SDBG, at "call get_angle_props (tprop(9:12), angle_props)" SDBG claims the dimension of "tprop(9:12)" is not 4.
I have NOW modified the program. Try this modified program below using /check and step through SDBG and it shows a dimension of 1 for dimen and 9 for props ?
Code: |
INTEGER*4 SEC_TYPE, UPROP(13)
REAL*8 TPROP(13)
!
tprop = 0
tprop(9:10) = .100
tprop(11:12) = .005
call SECTION_PROP (SEC_TYPE, TPROP, UPROP)
end
SUBROUTINE SECTION_PROP (SEC_TYPE, TPROP, UPROP)
!
! calculate section properties for generic section type
!
INTEGER*4 SEC_TYPE, UPROP(13), I
REAL*8 TPROP(13)
real*8 angle_props(9)
!
call get_angle_props (tprop(9:12), angle_props)
!
100 RETURN
!
END SUBROUTINE SECTION_PROP
subroutine get_angle_props (dimen, props)
!
! calculate the properties of an (un)equal angle
!
! real*8 dimen(4), props(9)
real*8 dimen(*), props(*)
REAL*8 AX,AY,AZ, B,D,T,W, B1,D1
integer nd, np
!
nd = size (dimen)
np = size (props)
!
!--- CHECK IF GIVEN AS A SECTION TYPE
!
D = dimen(1)
B = dimen(2)
T = dimen(3)
W = dimen(4)
!
D1 = D-T
B1 = B-W
!
! Area
AX = D*W + B1*T
AY = D*W
AZ = B*T
!
props(1) = ax ! ax
RETURN
END
|
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Wed Jul 21, 2010 2:41 pm Post subject: |
|
|
I am guessing a little here but you probably need an interface together with the corresponding change in the definition of the subroutine...
Code: |
interface
subroutine get_angle_props (dimen, props)
real*8 dimen(:), props(:)
end subroutine
end interface
|
I suspect that there will be something in the standard that says you have to do this (i.e. use assumed-size arrays). If this is not the case, let me know and I will look it up. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Wed Jul 21, 2010 11:43 pm Post subject: |
|
|
Paul,
I did have the declaration of : real*8 dimen(4), props(9)
I changed it to: real*8 dimen(*), props(*)
So that I could get through the subroutine call with /CHECK
nd = size (dimen) ! gives an incorrect value of 1
np = size (props) ! gives a correct value of 9
For either declaration, I don't think I need an INTERFACE
The problem is that the size of DIMEN is being provided incorrectly for /CHECK. Does the latetest fix address this problem ?
I only need this so /CHECK works past this point.
I thought my possible problems that require /CHECK are not with this routine.
John |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8277 Location: Salford, UK
|
Posted: Thu Jul 22, 2010 8:57 am Post subject: |
|
|
If you provide the interface for get_angle_props in the definition of sectin_prop then SDBG reports the sizes correctly.
The interface tells the compiler that the shapes of the arrays must be passed together with the base addresses. Otherwise get_angle_props does not receive the shapes of the arrays.
I can get the compiler to trap the explicit call to SIZE for a "star-sized" array but I don't know if anything can be done to "fix" SDBG in this context. |
|
Back to top |
|
 |
|
|
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
|