I attached a short code that produces segmentation faults (or strange cygwin
errors).  The segmentation faults only occur when compiling with both
-funroll-loops and -O3.  If one or the other or neither are used, the program
runs fine.  The code has several examples.  I attached a stackdump for the case
of the three write statements.

System : WinXP, cygwin, gcc version 4.3.0 20080212 (experimental)

==============================
subroutine test_sub(label)

character(len=*),intent(in) :: label

character (len=(len(label)+20)) :: c1
character (len=(len(label)+20)) :: c2
character (len=(len(label)+20)) :: c3

! the below 3 lines cause a segmentation fault
!  print*, len(c1)
!  print*, len(c2)
!  print*, len(c3)

! the below 2 lines produce strange cygwin errors
!          a ### sig_send: wait for sig_complete event failed, signal -34, rc
-1, Win32 error 6
!  print*, len(c1)
!  print*, len(c2)

! the below 1 lines produces no problem
!  print*, len(c3)

! the below 3 lines cause a segmentation fault (I gave the stackdump for this
case)
  write(c1,'(A)') 'a'
  write(c2,'(A)') 'b'
  write(c3,'(A)') 'c'

! the below 2 lines produce strange cygwin erros
!          a ### sig_send: wait for sig_complete event failed, signal -34, rc
-1, Win32 error 6
!  write(c1,'(A)') 'a'
!  write(c2,'(A)') 'b'

! the below 1 lines produces no problem
!  write(c1,'(A)') 'a'

end subroutine test_sub
!======================
program test

  call test_sub('a')
  print*, 'done'

end program test
!======================


-- 
           Summary: Segmentation fault with character strings only when
                    compiling with -funroll-loops and -O3
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot young at jrc dot co dot jp
GCC target triplet: i686-pc-cywgin


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

Reply via email to