I'm not completely sure that the following code is invalid, but I think it is.
Taken from:
http://home.comcast.net/%7Ekmbtib/Fortran_stuff/cyclic_specs1.f90

g95 prints:
  Error: Circular specification in variable 'ouch' at (1)

NAG f95 compiles it without any warning/error, however. Running it (using all
checks) shows either an empty line or
CHARACTER actual arg LEN=4 shorter than dummy arg LEN=1963731936
which indicates that it is indeed invalid.

Here is the source:
! File: cyclic_specs1.f90
! Public domain 2004 James Van Buskirk
! Leads to internal compiler error in g95
! Windows download of 12/18/04

module cyclic
   implicit none
   contains
      function ouch(x,y)
         implicit character(len(ouch)) (x)
         implicit character(len(x)+1) (y)
         implicit character(len(y)-1) (o)
         intent(in) x,y
         character(len(y)-1) ouch
         integer i

         do i = 1, len(ouch)
            ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i))))
         end do
      end function ouch
end module cyclic

program test
   use cyclic
   implicit none

   write(*,*) ouch('YOW!','     ')
end program test


-- 
           Summary: Endless loop when compiling a cyclic code
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to