"gfc_code2string(): Bad code" error for gfortran-4.3.2 on Darwin PPC

Chris Talley cst@cfdrc.com
Thu Sep 4 19:12:00 GMT 2008


I have run into a "gfc_code2string(): Bad code" error for  
gfortran-4.3.2 on Darwin PPC that did not occur with gfortran-4.2.4.  
I am running a PowerMac Dual G5 with MacOS X 10.4.11. I have  
reproduced the error in the following simplified test case:

=====================================
!*****************
! dummy_mod.F
module DUMMY !all global variables defined here
implicit none

logical (kind=1) :: MEMCHEKDONE = .false.

end module DUMMY
!*****************

!*****************
! count_test.F
module TESTCOUNT
use DUMMY
implicit none

contains

   subroutine ARRAYCOUNT
     integer, dimension(:), allocatable :: A
     integer :: NUM,CNT

     NUM = 5

     allocate(A(NUM))

     A(:) = 0
     A(2) = 1
     A(4) = 1

     CNT = count(A == 1)

     write(*,*) 'CNT = ', CNT
     deallocate(A)
   end subroutine ARRAYCOUNT

end module TESTCOUNT

!*****************
========================================


When compiled with the following commands:
 >gfortran-432 -ffree-form -c dummy_mod.F
 >gfortran-432 -ffree-form -c count_test.F

the following output occurs:
 >count_test.F:25.20:
 >
 >end module TESTCOUNT
 >                   1
 >Internal Error at (1):
 >gfc_code2string(): Bad code


The triggers for this error are the following two lines:
from dummy_mod.F -> logical (kind=1) :: MEMCHEKDONE = .false.
from count_test.F -> CNT = count(A == 1)

With both of these lines present, the error occurs. If either of  
these lines is eliminated, the code compiles without error. As I  
previously stated, the error does not occur with the 4.2.4 and  
earlier gfortran, but does occur with either 4.3.1 or 4.3.2. Is this  
a regression or am I doing something wrong in my coding?

Thanks for your help,


Chris Talley
Principal Aerospace Engineer
CFD Research Corporation
215 Wynn Drive
Huntsville, AL 35805
256-726-4835
cst at cfdrc dot com





More information about the Fortran mailing list