$ cat a.f90 character(10) string string = 'ABCDEEDCBA' write(*,*) index(string,'A',kind=1) end $ gfortran a.f90 && ./a.out 10
I suspect we're passing 1 as a logical BACK argument to the library function. Well, I do more than suspect, I checked and that's indeed what we do :) Work needed in trans-intrinsic.c, probably an easy one. Will need auditing other intrinsics that were added a KIND argument in F2003. -- Summary: KIND argument in INDEX results in wrong code Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36462