[Octopus-devel] [Octopus-notify] svn commit: r9018 - trunk/src/basic by dstrubbe
Tobias Burnus
tobias.burnus at physik.fu-berlin.de
Tue Apr 17 16:48:29 WEST 2012
On Tue, Apr 17, 2012 at 08:56:25AM -0400, Xavier Andrade wrote:
> Now I get "rc/" at the beginning of each path. The weird thing is that
> I am using gfortran too. But the intel compiler gives me the same
> result. How does you path look? Mine is ../../../src/.
>
> On Tue, Apr 17, 2012 at 1:28 AM, <octopus-svn at tddft.org> wrote:
> > Author: dstrubbe
> > Changeset: http://www.tddft.org/trac/octopus/changeset/9018
> > Log:
> > Fix to r9004: using pathscale and gfortran at least, I find that the first three letters of the filename are clipped off. Was this really working on some compiler, Xavier? If so, I guess a more consistently implemented function that 'index' is required.
First, INDEX is well defined. Quoting Fortran 2008 (Sect. 13.7.80):
"Case (ii): If BACK is present with the value true, the result is the
maximum value of I less than or equal to LEN (STRING) - LEN (SUBSTRING) + 1 such
that STRING (I : I + LEN (SUBSTRING) - 1) = SUBSTRING or zero if there is no such
value. Zero is returned if LEN (STRING) < LEN (SUBSTRING) and LEN (STRING) + 1
is returned if LEN (SUBSTRING) = 0."
The same definition is in the Fortran 90 standard (Section 13.13.46), while
FORTRAN 77 didn't support this the back= flag.
Secondly, I tried the following program with gfortran 4.1.2, gfortran 4.8,
ifort 12.1, pgf90 10.1-0 and pathf95 3.2.99 -- all print " something/more"
for the following program. Thus, I am really surprised that it didn't work
for you. Can you write a minimal program which shows the problem?
! ----------- cut ----------------
integer :: pos
character(len=60) :: str ='Hello/world/src/something/more'
pos = index(str, 'src/', back = .true.)
print *, str(pos+4:)
end
! ----------- cut ----------------
Tobias
More information about the Octopus-devel
mailing list