[Bug fortran/33241] New: ICE when compilation

2007-08-29 Thread victor dot prosolin at gmail dot com
#x27;)! Mark
  IF (Bflag) THEN
 InMan=.true.; Bflag=.false. ! - beginning of
mantissa
  ELSEIF (Eflag) THEN
 InExp=.true.; Eflag=.false. ! - beginning of
exponent
  ENDIF
  IF (InMan) DInMan=.true.   ! Mantissa
contains digit
  IF (InExp) DInExp=.true.   ! Exponent
contains digit
   CASE ('.')
  IF (Bflag) THEN
 Pflag=.true.! - mark 1st
appearance of '.'
 InMan=.true.; Bflag=.false. !   mark beginning
of mantissa
  ELSEIF (InMan .AND..NOT.Pflag) THEN
 Pflag=.true.! - mark 1st
appearance of '.'
  ELSE
 EXIT! - otherwise STOP
  END IF
   CASE ('e','E','d','D')! Permitted only
  IF (InMan) THEN
 Eflag=.true.; InMan=.false. ! - following
mantissa
  ELSE
 EXIT! - otherwise STOP
  ENDIF
   CASE DEFAULT
  EXIT   ! STOP at all
other characters
   END SELECT
   in = in+1
END DO
err = (ib > in-1) .OR. (.NOT.DInMan) .OR.
((Eflag.OR.InExp).AND..NOT.DInExp)
IF (err) THEN
   res = 0.0_rn
ELSE
   READ(str(ib:in-1),*,IOSTAT=istat) res
   err = istat /= 0
END IF
IF (PRESENT(ibegin)) ibegin = ib
IF (PRESENT(inext))  inext  = in
IF (PRESENT(error))  error  = err
  END FUNCTION RealNum
  !
  SUBROUTINE LowCase (str1, str2)
!-  - - - - - -
---
! Transform upper case letters in str1 into lower case letters, result is
str2
!-  - - - - - -
---
IMPLICIT NONE
CHARACTER (LEN=*),  INTENT(in) :: str1
CHARACTER (LEN=*), INTENT(out) :: str2
INTEGER:: j,k
CHARACTER (LEN=*),   PARAMETER :: lc = 'abcdefghijklmnopqrstuvwxyz'
CHARACTER (LEN=*),   PARAMETER :: uc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
!-  - - - - - -
---
str2 = str1
DO j=1,LEN_TRIM(str1)
   k = INDEX(uc,str1(j:j))
   IF (k > 0) str2(j:j) = lc(k:k)
    END DO
  END SUBROUTINE LowCase
  !
END MODULE fparser


PROGRAM fptest
  !-  - - - - -
- -
  !
  ! Example program 4 for using the function parser module
  !
  !-  - - - - -
- -
  USE parameters, ONLY: rn
  USE fparser
  IMPLICIT NONE
  INTEGER, PARAMETER :: nfunc = 1
  CHARACTER (LEN=*), DIMENSION(nfunc), PARAMETER :: func = (/ '1.0e0 + 5.e1' /)
  INTEGER, PARAMETER :: nvar = 0
  CHARACTER (LEN=*), DIMENSION(nvar),  PARAMETER :: var  = 'a'
  REAL(rn),  DIMENSION(nvar),  PARAMETER :: val  = 0._rn
  REAL(rn)   :: res
  INTEGER:: i
  !-  - - - - -
- -
  !
  CALL initf (nfunc)  ! Initialize function parser for
nfunc functions
  DO i=1,nfunc
 WRITE(*,*)'UP parsef'
 CALL parsef (i, func(i), var)! Parse and bytecompile ith function
string
  END DO
  DO i=1,nfunc
 WRITE(*,*)'FCN evalf'
 res = evalf (i, val) ! Interprete bytecode representation
of ith function
 IF (EvalErrType > 0) WRITE(*,*)'*** Error: ',EvalErrMsg ()
 WRITE(*,*)'res=',res
  END DO
  !
END PROGRAM fptest


-- 
   Summary: ICE when compilation
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: victor dot prosolin at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug fortran/33241] ICE with parameter string arrays

2007-08-30 Thread victor dot prosolin at gmail dot com


--- Comment #4 from victor dot prosolin at gmail dot com  2007-08-30 17:09 
---
I am sorry for posting such a long example, but the code was not written by me
so I didn't want to make stupid changes. It's my first time reporting a bug via
bugzilla so don't be too critical about me not figuring out how to create an
attachment instead of posting it as a message.
Additional info: Intel Fortran, Sun Fortran, openf95 and g95 pass this code
with no problem, though g95 segfaults on execution. 


-- 


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