../Src/fparser.f90:329: internal compiler error: in
gfc_conv_array_constructor_expr, at fortran/trans-expr.c:1975

The problem is at the line "CHARACTER (LEN=LEN(Funcs)) :: fun"
It goes away if changed to: LEN=LEN(Funcs(cAbs))
but I believe the standard says the argument to LEN() can be
array valued (I don't have my copy handy, but my DEC Reference Manual,
which is rarely wrong, says this.)

Here's the code:

MODULE fparser
  IMPLICIT NONE
  INTEGER, PARAMETER :: is = SELECTED_INT_KIND(4) ! Data type of bytecode
  PRIVATE
  SAVE
  INTEGER(is),                              PARAMETER :: cImmed   = 1,         
&
                                                         cAbs     = 8,         
&
                                                         cExp     = 9,         
&
                                                         cLog10   = 10,        
&
                                                         cLog     = 11,        
&
                                                         cSqrt    = 12,        
&
                                                         cSinh    = 13,        
&
                                                         cCosh    = 14,        
&
                                                         cTanh    = 15,        
&
                                                         cSin     = 16,        
&
                                                         cCos     = 17,        
&
                                                         cTan     = 18,        
&
                                                         cAsin    = 19,        
&
                                                         cAcos    = 20,        
&
                                                         cAtan    = 21,        
&
                                                         VarBegin = 22
  CHARACTER (LEN=5), DIMENSION(cAbs:cAtan), PARAMETER :: Funcs    = (/ 'abs  ',
&
                                                                       'exp  ',
&
                                                                       'log10',
&
                                                                       'log  ',
&
                                                                       'sqrt ',
&
                                                                       'sinh ',
&
                                                                       'cosh ',
&
                                                                       'tanh ',
&
                                                                       'sin  ',
&
                                                                       'cos  ',
&
                                                                       'tan  ',
&
                                                                       'asin ',
&
                                                                       'acos ',
&
                                                                       'atan '
/)
CONTAINS
  FUNCTION MathFunctionIndex (str) RESULT (n)
    IMPLICIT NONE
    CHARACTER (LEN=*), INTENT(in) :: str
    INTEGER(is)                   :: n,j
    INTEGER                       :: k
    CHARACTER (LEN=LEN(Funcs))    :: fun
    n = 0
    DO j=cAbs,cAtan                                          ! Check all math
functions
       k = MIN(LEN_TRIM(Funcs(j)), LEN(str))   
       CALL LowCase (str(1:k), fun)
       IF (fun == Funcs(j)) THEN                             ! Compare lower
case letters
          n = j                                              ! Found a matching
function
          EXIT
       END IF
    END DO
  END FUNCTION MathFunctionIndex

END MODULE fparser


-- 
           Summary: internal compiler error in gfortran
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dbs at hpcrdm dot lbl dot gov
 GCC build triplet: same
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: same


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24813

Reply via email to