[Patch] Enable Hollerith constant and character array in format tag
Feng Wang
wf_cs@yahoo.com
Sun Jul 17 07:34:00 GMT 2005
--- Paul Thomas <paulthomas2@wanadoo.fr> wrote:
> Hello Feng Wang,
>
> Feng Wang wrote:
>
> >
> >Oh. I don't handle AR_SECTION in this function. In fact, I don't understand
> the
> >syntax meaning if an array section appears. IIRC, the f95 standard forbids
> >this.
> >
> That's right. I will take a look at the standard this afternoon. Right
> now, I am cutting concrete slabs for some steps. By midday it will be
> too hot to continue.
>
> Yes, I too found the error with ifort. This runs:
>
> program test
> character(len=11) :: a(6)
> write (a(2:), '(a11)') "I know this"," is bad for"," me but&
> & I'l","l just have"," to do it "
> print *, a
> end program test
>
Paul T,
This program reminds me that it is not easy to deal with array section. See a
two dimentsions array program:
character*6 c (3,3)
c = 'Hello'
write (c(2:,2:) ,'(A5)'), 'world', 'world','world'
print *, c
end
The output is :
Hello Hello Hello Hello world world Hello world Hello
~~~~~~~~~~~ ~~~~~
Three 'world's are not sequent. They are written to the section c(2:3,2:3). So
it is not enough to get first element address and element length. We need more
about the section, at least the upper and lower bounds of each dimention. If we
don't want to recalculate the offset or the strides in the library, we must
also give such infomation in the front-end.
Thus we need build a new section information struct. This stuct can be seen by
library like ioparm_*. It can be defined as the same with full array descriptor
except the ranges of each dimention. If we get these in the library, we can
write to the proper unit.
I once thought about scalarizing the statement like "c(2:,2:) = 'world'". But
it is more complex and I don't think it is a good method.
And I will not have time on gfortran this and next month. It's a pity not to
contribute more. Sigh.
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Fortran
mailing list