[Patch] Enable Hollerith constant and character arrayin format tag
Feng Wang
wf_cs@yahoo.com
Sat Jul 16 06:34:00 GMT 2005
--- Paul Thomas <paulthomas2@wanadoo.fr> wrote:
> Feng Wang,
>
> program test
> character*11 :: a(6)
> write (a(2:), '(a)') "I know this is bad for me but&
> &I'll just have to do it"
> end program test
>
> ICEs at the gfc_conv_expr in gfc_convert_array_to_string.
>
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.
I have to see ifort(8.1) how to handle this.
The program you post runs error if compiled with ifort. And I changed as
follows:
character*6 c (3,3)
c = 'Hello'
write (c(1:,2:), '(A)') 'world'
print *, c
end
The output is:
Hello Hello Hello world Hello Hello Hello Hello Hello
If I change the internal to (1:2,2:), it is the same output.
If I change to c(1:,:), the output is:
world Hello Hello Hello Hello Hello Hello Hello Hello
If I change the string to 'world!!', it will give the run error:
output statement overflows record.
So I think we can handle array section like this:
(1). Use the first element's address in the section.
(2). The length is the element's length.
And as Tobi once pointed out, writing to an internal character array is
different with writing with a character array format. I also tested the program
as follows:
character*6 c (3,3)
c(3,3) = '(i4)'
write (*, c(3:,3)) 5
end
It is compiled fine by ifort but runs error.
If we handle it like (1,2), it will also runs fine.
Thought?
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
More information about the Fortran
mailing list