This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/51652] New: [F03] ICE with allocatable scalars


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

             Bug #: 51652
           Summary: [F03] ICE with allocatable scalars
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: davidgkinniburgh@yahoo.co.uk


module settings

type keyword
!  character(60), allocatable :: c(:)   ! works but should it?
!  character(80), allocatable :: c(:)   ! works
   character(:), allocatable :: c(:)
end type keyword

type(keyword) :: kw(10)

contains

subroutine save_kw

!allocate(kw(1)%c(10))
allocate(character(80) :: kw(1)%c(10))

kw(1)%c(1) = 'abcd'

if (kw(1)%c(1).eq.'abcd') then  ! problem here
   print *, 'yes'
else
   print *, 'no'
endif

end subroutine save_kw

end module settings

!*************************************************************************

program ice
use settings

call save_kw

end program ice


gcc version 4.7.0 20111212 (experimental) [trunk revision 182257] (GCC)

=========================================================================
f951.exe: internal compiler error: in gfc_get_derived_type, at
fortran/trans-types.c:2401

I'm also interested in testing substrings like

if (kw(1)%c(1)(1:1).eq.'a') then ...

The above program works ok with non-deferred scalar lengths. However, it also
works when the component is assigned different lengths in the subroutine and
main body (e.g. 60 and 80) whereas Intel Fortran reports this as an error: "In
an ALLOCATE statement the type parameter values in type specification must be
the same as a corresponding nondeferred values of the objects being
allocated.".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]