Subject: fix for intel fortran 8.0

From: Christoph van Wüllen <Christoph.vanWullen*at*TU-Berlin.De>
Date: Tue, 16 Dec 2003 10:09:41 +0100

Dear all,

when I tested the new Intel Fortran compiler, version 8.0, I noticed that
quantum chemistry software did not pass the test suite. This could be traced
down to a (sometimes) non-working FORTRAN index() function. Substituting the
support function by the following C code (somewhere in your C source files)
fixed the problem. Of course, one could compile this bit separately and
substitute the library entry, but this is INTELs job. The fix is quick
and dirty but ---- works.

long for_f90_index(source,lens,target,lent,back)
char *source,*target;
int lens,lent,back;
{

long i;

/* hand-made index function */
if (lent == 0) {
    if (!back) {
      return 0;
    } else {
      return lens+1;
    }
}
if (!back) {
    for (i=0; i<=lens-lent; i++) {
       if (!memcmp(source+i,target,(size_t) lent)) return (i+1);
    }
} else {
    /* backward search */
    for (i=lens-lent; i>=0; i--) {
       if (!memcmp(source+i,target,(size_t) lent)) return (i+1);
    }
}
if (!back) {
   return 0;
} else {
   return lens+1;
}
}

+---------------------------------+----------------------------------+
| Prof. Christoph van W|llen      | Tele-Phone (+49) (0)30 314 27870 |
| Technische Universitdt Sekr. C3 | Tele-Fax   (+49) (0)30 314 23727 |
| Stra_e des 17. Juni 135         | eMail                            |
| D-10623 Berlin, Germany         | Christoph.vanWullen*at*TU-Berlin.De |
+---------------------------------+----------------------------------+
--