------- Comment #1 from Eric dot Zurcher at csiro dot au  2010-08-10 02:16 
-------
The FORTRAN code given below causes gfortran to fail with the message:
f951.exe: internal compiler error: Segmentation fault

I have tested this using the Mingw32 version of gfortran 4.5.0, and version
4.3.2 on SUSE Linux. 

The code does contain a known error: the argument "variable" should be passed
as an array of strings, not as just the first string in the array. However,
this incorrect code should not cause the compiler to segmentation fault.



      Module BugDemo

      integer M
      parameter (M=100)

      Type aRecord
      SEQUENCE
        character        soil_type(0:M)*20 
      End Type aRecord

      Type (aRecord),Pointer ::  p

      contains

! ====================================================================
       subroutine read_char_array
     .     (section_name, variable_name, size_of,
     .      units, variable, numvals)
! ====================================================================
      implicit none

!+ Sub-Program Arguments
      character section_name*(*)       ! (INPUT) section name to search for
      character variable_name*(*)      ! (INPUT) Variable name to search for
      integer size_of                  ! (INPUT) size_of of array
      character units*(*)              ! (INPUT) Units required by caller
      character variable(*)*(*)        ! (OUTPUT) Variable returned to caller
      integer numvals                 ! (OUTPUT) Number of values returned

      logical found

!- Implementation Section ----------------------------------

      found = .TRUE.
      return
      end subroutine

      subroutine dotest

      !Use ReadModule
      Implicit None
      integer numvals

      allocate(p)       

              call Read_char_array (
     :              'init',
     :              'soil_type',
     :              M+1,
     :              '(?)',
     :              p%soil_type(0),   ! THIS IS WRONG
     :              numvals)

      deallocate(p)     
      return

      end subroutine

      end module BugDemo


-- 


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

Reply via email to