public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51652] New: [F03] ICE with allocatable scalars
@ 2011-12-22  4:04 davidgkinniburgh at yahoo dot co.uk
  2011-12-22  8:44 ` [Bug fortran/51652] [F03] ICE with allocatable scalarstype parameter burnus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: davidgkinniburgh at yahoo dot co.uk @ 2011-12-22  4:04 UTC (permalink / raw)
  To: gcc-bugs

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.".


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-07 20:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-22  4:04 [Bug fortran/51652] New: [F03] ICE with allocatable scalars davidgkinniburgh at yahoo dot co.uk
2011-12-22  8:44 ` [Bug fortran/51652] [F03] ICE with allocatable scalarstype parameter burnus at gcc dot gnu.org
2011-12-22  9:50 ` [Bug fortran/51652] Allocate with type-spec and source-expr: check whether length type-parameter is the same is lacking burnus at gcc dot gnu.org
2011-12-22 16:36 ` davidgkinniburgh at yahoo dot co.uk
2012-01-10 11:22 ` burnus at gcc dot gnu.org
2012-06-29 18:20 ` mikael at gcc dot gnu.org
2014-07-20  8:48 ` dominiq at lps dot ens.fr
2015-08-07 20:24 ` mikael at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).