bug in g95 with character arrays?
- From: wim <wim.van.hoydonck@xxxxxxxxx>
- Date: Sat, 28 Jun 2008 06:47:31 -0700 (PDT)
Hi all,
ifort and gfortran compile the following without complaining:
$ cat mtest.f90
module mtest
implicit none
character(len=5), parameter :: test(5) =
["tan","atan2","atan","sin","asin"]
end module mtest
Not so with g95:
$ g95 -c -o mtest.o mtest.f90
In file mtest.f90:3
character(len=5), parameter :: test(5) =
["tan","atan2","atan","sin","asin"]
1
Error: Element in character array constructor at (1) has length 5
instead of 3
Does the standard say anything about what the compiler should do with
the elements in a character array that have a length shorter than the
one defined by its length, or should i always pad string parameters
with spaces by hand?
Still, this is a bug i think, as g95 doesn't take the declared length
into account but uses the length of the first element in the array?
Greetings,
Wim
.
- Follow-Ups:
- Re: bug in g95 with character arrays?
- From: Richard Maine
- Re: bug in g95 with character arrays?
- From: Steve Lionel
- Re: bug in g95 with character arrays?
- Prev by Date: Re: Is it time to legitimise REAL*8 etc?
- Next by Date: Re: Is it time to legitimise REAL*8 etc?
- Previous by thread: Re: Doubt about formula transcription
- Next by thread: Re: bug in g95 with character arrays?
- Index(es):