Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

Problem with 'index' intrinsic function (Version 8.0)

guentert
Beginner
375 Views
The program

program test
character*10 s
s='AAB'
print *,index(s(1:2),'AB')
end

when compiled with 'ifort test.f' under Redhat 9 produces as output:

2

instead of the correct result, 0. Interestingly, the result is correct when the first character of the value of the variable s is not 'A'.


Output of 'ifort -V':

Intel Fortran Compiler for 32-bit applications, Version 8.0 Build 20031016Z
Package ID: l_fc_p_8.0.034
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY
0 Kudos
1 Reply
TimP
Honored Contributor III
375 Views
Why not check the past posts to see which versions fixed the index intrinsic, and which have work-arounds for red hat 9, given that you're into running obsolete compilers and linux distros?
0 Kudos
Reply