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 error

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



Joined: 19 Jun 2008
Posts: 3

PostPosted: Fri Jul 23, 2010 12:27 am    Post subject: compiler error Reply with quote

Hi, I get a compiler error with silverfrost/FTN95, which I do not see in Lahey fortran (Windows XP X64, service pack 2).

The error is "error 304 - Non-writable expression in READ statement"
The code in question is below it is the first read statement that appears to be causing a problem.

All help gratefully received. I don't know what to do next. I can find no helpful description of this error message to give me a clue what is going wrong.

best regards... Iain

SUBROUTINE read_wavecar(wave)
TYPE(wave_obj) :: wave

open(unit=12,file="WAVECAR",status="old",form="unformatted")

! Read in from WAVECAR:
! the number of k-points
! the number of bands
! the energy maximum
! the cell dimensions
! the type of VASP code

read(12) nkpt,nband,emax,((A(i,j),i=1,3),j=1,3)

!????????????????????????????????????????????????????????
! write(19,*)
! write(19,*) 'nkpt =',nkpt
! write(19,*) 'nband =',nband
! write(19,*) 'emax =',emax
! write(19,*) 'A='
! write(19,'(3X,3(1X,f8.3))') (A(i,1),i=1,3)
! write(19,'(3X,3(1X,f8.3))') (A(i,2),i=1,3)
! write(19,'(3X,3(1X,f8.3))') (A(i,3),i=1,3)
!????????????????????????????????????????????????????????

read(12) code
DO ikpt=1, nkpt

! Read in from WAVECAR:
! the number of pw wave fns
! the k-point

read(12) npw, kpt(1:3)

!????????????????????????????????????????????????????????
! write(19,*)
! write(19,'("k-point #",I3,": (",3f7.4,") npw=",I6)')
! & ikpt, (kpt(i),i=1,3),npw
! write(19,*) 'kpt =',kpt
! write(19,*) 'npw =',npw
! write(19,*) " band energy weight"
!
!????????????????????????????????????????????????????????

ALLOCATE(coef(npw))
ALLOCATE(ac(npw,200))
ic = 1
DO iband = 1, nband

! Read in from WAVECAR:
! the energy (eval)
! the occupation (fweight)

read(12) eval, fweight, (coef(i),i=1,npw)

!????????????????????????????????????????????????????????
! write(19,'(5X,I3,5X,f8.4,5x,f8.4)') iband, dreal(eval), fweight
!????????????????????????????????????????????????????????

! Create matrix (ac):
! row: coefficients for plane waves
! column: coeff of 1st plane wave for bands interested in

! IF(iband >= nbandmin.and.iband.le.nbandmax) then
DO i = 1,npw
ac(i,ic) = coef(i)
ENDDO
ic = ic+1
! end if

ENDDO
DEALLOCATE(coef)
ENDDO
close(unit=12)
_________________
Ross
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 23, 2010 8:51 am    Post subject: Reply with quote

I have had a quick look at this but I cannot see any immediate problems.

You may need to provide more information.
The context is presumably a module that provides TYPEs and declarations.

Try posting the context but with the program cut down to a minimum that shows the problem.
Back to top
View user's profile Send private message AIM Address
imcnab



Joined: 19 Jun 2008
Posts: 3

PostPosted: Fri Jul 23, 2010 4:50 pm    Post subject: Reply with quote

Hi, I atempted to include the whole module in this reply (not my code, so I'm not comfortable cutting it down), but although I can see it in Preview, it disappears once the message is posted. I'm guessing a line limit, but I cannot find instructions on this, or on how to attach a file.
I have uploaded the responsible code to:

http://www.utoronto.ca/jpolanyi/Iain/wavecar_mod.f90

FTN95 reports two errors
"error 246 - The END statement cannot be used to end an internal SUBROUTINE, use END SUBROUTINE instead" (that's pretty clear, no problem about doing that).
and
"error 304 - Non-writable expression in READ statement"
applying to the first read. That's too cryptic for me. In the documentation I cannot find a list of errors and less cryptic meanings. Does such a one exist?

These errors are not picked up in Lahey fortran or Intel fortran (X64).

All help most gratefully received. I'd really like to be able to run this code.
Thank you for your time and help, I truly appreciate it.

best regards... Iain
_________________
Ross
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Thu Jul 29, 2010 5:34 pm    Post subject: Reply with quote

The Salford/Silverfrost compiler does not know how to process subprogram dummy arguments with the allocatable attribute, which are not legal in Fortran 95 without the TR 15581 extensions.

Had you passed the allocatable arrays individually, instead of their being squirreled away within a derived type, the compiler would have given you an appropriate message. But, since 'wave_obj' has components that are allocatable, the compiler is confused.


Last edited by mecej4 on Tue Feb 22, 2011 11:56 am; edited 1 time in total
Back to top
View user's profile Send private message
imcnab



Joined: 19 Jun 2008
Posts: 3

PostPosted: Thu Jul 29, 2010 7:14 pm    Post subject: Reply with quote

Very Happy
Thank you very much for your help.
Not my code, but I guess the author enjoys squirreling things away.

Best regards and many thanks ... Iain
_________________
Ross
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Sat Aug 14, 2010 11:05 pm    Post subject: Reply with quote

I didn't mean to be critical of defining and using structured variables. The error messages that a compiler emits can be incomprehensible when it has been given code in a language version that it does not know about, but the user expects it to be able to compile.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Feb 10, 2011 12:03 am    Post subject: Reply with quote

I thought I would never see this error, as I still write in Fortran 77 style, and thought it was a fancy modern sort of thing that was causing your message. However, I saw it yesterday. It came inside a loop where I was asking:

Code:
READ(27,*) (A(I), B(I), I=1,Number_of_Things)


First of all I checked Number_Of_Things was spelled correctly. Of course, the error was failing to dimension both A and B!

FTN95 error messages are usually very understandable. I had to puzzle out what this one meant, and that took longer than fixing the underlying problem. Mostly they tell you what is wrong in "Fortran programmer" language, so you can immediately tell what you have to do to fix it. The "Non-writable ..." etc message is telling you how the compiler sees it.

Did you ever fix your problem?

Eddie
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