ERRMSG

54 views
Skip to first unread message

Andrew Baldwin

unread,
Jun 2, 2011, 12:20:30 PM6/2/11
to gnu-f...@googlegroups.com
I am using the ERRMSG feature of ALLOCATE and DEALLOCATE, but am having trouble finding documentation on the specifics of ERRMSG. I would like to use a deferred length character for ERRMSG, but if I do so as in this sample code

program main
character (len = :), allocatable :: emsg
integer :: st
integer, allocatable :: i(:)

allocate (i(5), stat=st, errmsg=emsg)
if (st .ne. 0) print *, emsg
allocate (i(5), stat=st, errmsg=emsg)
if (st .ne. 0) print *, emsg
end program

then I receive a the error message

Job 1, “./quicktest.x ” terminated by signal SIGSEGV (Address boundary error)

I'm uncertain if this is a mistake I'm making (maybe ERRMSG must be allocated beforehand?) or the result of a partial implementation of deferred length characters. Should this (or another way to give ERRMSG arbitrary length) be possible eventually? If there's currently no arbitrary length way to specify ERRMSG, is there a maximum length of ERRMSG that can be expected?

Thank you,
Andrew Baldwin
Reply all
Reply to author
Forward
0 new messages