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 

Compiler issues?

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



Joined: 15 Jun 2006
Posts: 46

PostPosted: Thu Mar 14, 2013 7:11 pm    Post subject: Compiler issues? Reply with quote

Hi there,

If I have Modules:

!<=================================================

Module Whatever_hdr

Type stWhatever
Type-Whatever :: iBovvered
EndType stWhatever

End Module Whatever_hdr

!>=================================================

!<=================================================

Module Spots_hdr

!! Modules
USE Whatever_hdr !! stWhatever

Type stSpots
Integer*4 :: iVariable
Type(stWhatever) :: pstWhatever
EndType stSpots

End Module Spots_hdr

!>=================================================

!<=================================================

Module Spots

IMPLICIT NONE

Contains

!=================================================

Logical*4 Function Spots_Func(pstSpotsP)

!! Modules
USE Spots_hdr !! stSpots

!! Passed
Type(stSpots), INTENT(INOUT) :: pstSpotsP

!! Locals
Logical*4 bNoErrorL, bEverthingOkL

bEverthingOkL = .FALSE.
Do
Do something with pstSpots perhaps

bEverthingOkL = .TRUE.
Exit
Enddo

Spots_Func = bEverthingOkL
End Function Spots_Func

!=================================================

End Module Spots

!>=================================================

!<=================================================

Module Leopard_hdr

!! Modules
USE Spots_hdr !! stSpots

Type stLeopard
Integer*4 :: iCount
Integer*4 :: iEnd
Type(stSpots), Pointer :: ptrSpots
EndType stLeopard

End Module Leopard_hdr

!>=================================================

!<=================================================

Module Leopard

IMPLICIT NONE

Contains

!! Modules
USE Leopard_hdr !! stLeopard

!! Declarations
Type(stLeopard), Private :: pstLeopardM

!=================================================

Logical*4 Function Leopard_Func1(pstSpotsP)

!! Modules
USE Spots !! Spots_Func

!! Passed
Type(stProject), Target :: pstSpotsP

!! Locals
Logical*4 bNoErrorL, bEverthingOkL

bEverthingOkL = .FALSE.
Do
pstLeopardM%ptrSpots => pstSpotsP

a) bNoErrorL = Spots_Func(pstSpotsP)
If(.NOT.bNoErrorL) Exit

b) bNoErrorL = Spots_Func(pstLeopardM%ptrSpots)
If(.NOT.bNoErrorL) Exit

bEverthingOkL = .TRUE.
Exit
Enddo

Leopard_Func1 = bEverthingOkL
End Function Leopard_Func1

!=================================================

!=================================================

Logical*4 Function Leopard_Func2()

!! Locals
Logical*4 bNoErrorL, bEverthingOkL

bEverthingOkL = .FALSE.
Do
Do pstLeopardM%iCount = 1, pstLeopardM%iEnd
Do something (with Exit condition), or even do nothing, makes no odds
Enddo

bEverthingOkL = .TRUE.
Exit
Enddo

Leopard_Func2 = bEverthingOkL
End Function Leopard_Func2

!=================================================

Subroutine Leopard_New()

pstLeopardM%iCount = -1
pstLeopardM%iEnd = -1
NULLIFY(pstLeopardM%pstSpots)
End Subroutine Leopard_New

!=================================================


End Module Leopard

!>=================================================

Assuming I have the above pseudo-code correct (hope y'all get the idea) and
Leopard_New has been called and all other structures etc have been initialised etc, then:

If I use (a) this gives: Error 15, Attempt to access undefined argument to routine
If I use (b) then no such error occurs and carries on ...

Why is this?


In Leopard_Func2, the compiler returns:
error 227 - DO control variables must be INTEGER or REAL scalar variables only
error 52 - Compilation abandoned
However, both iCount and iEnd are Integer*4
I replaced iEnd with a local Integer*4 == still get error.
I replaced iCount with a local Integer*4 and it compiles with no errors.

I swapped the order of iCount and iEnd in stLeopard, but the compiler still complained about iCount.
I have checked spelling, copy-Pasted th
Back to top
View user's profile Send private message
MarzAttax



Joined: 15 Jun 2006
Posts: 46

PostPosted: Thu Mar 14, 2013 7:17 pm    Post subject: ...addendum Reply with quote

I swapped the order of iCount and iEnd in stLeopard, but the compiler still complained about iCount.
I have checked spelling, copy-Pasted the structure-name and iCount - all to no avail Surprised(

Do you think this anything to do with my post:
Mon Nov 19, 2012 5:31 pm Post subject: The structure of things

to which Paul replied:

Tue Nov 20, 2012 4:30 pm
This is a compiler fault and I have logged it for investigation.

?

In closing I feel the need to say that, over the past years that I have used this IDE I have found "it"
really does not like having modules declared at the start of a module, for example:

Module Leopard

!! Modules
USE Leopard_hdr !! stLeopard

especially if they contain executable code. I have found that if the source-file is "large enough" then
code "far enough" down appears to not "see" these modules and "have" to be declared locally.
It's all rather confusing really.

Why I opted to do so in Leopard is beyond me, a sign of the onset of insanity perhaps SurprisedÞ


Kinds regards
Marz
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 14, 2013 8:21 pm    Post subject: Reply with quote

If you were to post a small sample of Fortran code that we could compile and run, then we might be able to offer some positive advice.
Back to top
View user's profile Send private message AIM Address
MarzAttax



Joined: 15 Jun 2006
Posts: 46

PostPosted: Fri Mar 15, 2013 2:17 pm    Post subject: Ok, try this: Reply with quote

ExeMain.f95:

Program ExeMain

USE Leopard !! bLeopard

IMPLICIT NONE

!<<
!=================================================
!=================================================
!<<

!! Locals
Logical*4 :: bNoErrorL

Do
bNoErrorL = bLeopard()
If(.NOT.bNoErrorL) Exit

Exit
Enddo

!>>
!=================================================
!=================================================
!>>
End Program ExeMain




ForTheLoveOfGod_hdr.f95:

Module ForTheLoveOfGod_hdr

Type stForTheLoveOfGod
Integer*4 :: iCount1
Integer*4 :: iNumber1
Integer*4 :: iNumber2
Integer*4 :: iCount2
EndType stForTheLoveOfGod

End Module ForTheLoveOfGod_hdr




Leopard.f95:

Module Leopard

!! Modules
USE ForTheLoveOfGod_hdr !! stForTheLoveOfGodM

IMPLICIT NONE

!! Declarations
Type(stForTheLoveOfGod), Private :: pstForTheLoveOfGodM

Contains

Logical*4 Function bLeopard()

Do pstForTheLoveOfGodM%iNumber1 = 1, pstForTheLoveOfGodM%iCount2
Enddo

End Function bLeopard

End Module Leopard
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Mar 15, 2013 5:25 pm    Post subject: Reply with quote

You can not use pstForTheLoveOfGodM%iNumber1 as the control variable in the DO loop. It must be a simple integer not a member of a type.
Back to top
View user's profile Send private message AIM Address
MarzAttax



Joined: 15 Jun 2006
Posts: 46

PostPosted: Fri Mar 15, 2013 5:38 pm    Post subject: Dumbstruck Reply with quote

Now why does that not surprise me - this IS Fortran after all.

Well, one learns something new every day.

Thanks for your response Paul.
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