public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/16937] New: Compiler segmentation fault - compound derived types are not acceptable function arguments
@ 2004-08-09 14:22 paulthomas2 at wanadoo dot fr
  2004-08-09 16:03 ` [Bug fortran/16937] " pinskia at gcc dot gnu dot org
  2004-08-09 17:45 ` reichelt at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2004-08-09 14:22 UTC (permalink / raw)
  To: gcc-bugs

! $ ../bin/gfortran bug4.f90 -o test
! bug4.f90: In function `MAIN__':
! bug4.f90:30: internal compiler error: Segmentation fault
! Please submit a full bug report,
! with preprocessed source if appropriate.
! See <URL:http://gcc.gnu.org/bugs.html> for instructions.
!
!Apparently compound derived types are not acceptable function arguments

  program Array_List 
    implicit none 
    character (len=5),dimension(3)  :: carray = (/"one","two","three"/)

    type :: Compound 
      integer                       :: Count 
      character (len = 4)           :: Name 
    end type Compound 

    type :: Table 
      type (Compound)               :: Data (2)  
      integer :: L_Size  
    end type Table 
 
    type (Compound)                 :: Element1  = Compound(1,"one")
    type (Compound)                 :: Element2  = Compound(2,"two")
 
    type (Table) :: ElementTable
    ElementTable%Data(1) = Element1
    ElementTable%Data(2) = Element2
    ElementTable%L_size  = 2 

    print *, test( ElementTable%Data(: ElementTable%L_size )%Name )

!! the following work correctly

!!    print *,  ElementTable%Data(: ElementTable%L_size )%Name 
!!    print *, test( carray )

    stop

      contains
        function test ( list ) result ( num )
	integer                      :: num
	character (len=*)            :: list(:)
	num = Size( List )
	return
	end function test

  end program Array_List

-- 
           Summary: Compiler segmentation fault - compound derived types are
                    not acceptable function arguments
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulthomas2 at wanadoo dot fr
                CC: bdavis at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org


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


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

* [Bug fortran/16937] Compiler segmentation fault - compound derived types are not acceptable function arguments
  2004-08-09 14:22 [Bug fortran/16937] New: Compiler segmentation fault - compound derived types are not acceptable function arguments paulthomas2 at wanadoo dot fr
@ 2004-08-09 16:03 ` pinskia at gcc dot gnu dot org
  2004-08-09 17:45 ` reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-09 16:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-09 16:03 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-09 16:03:09
               date|                            |


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


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

* [Bug fortran/16937] Compiler segmentation fault - compound derived types are not acceptable function arguments
  2004-08-09 14:22 [Bug fortran/16937] New: Compiler segmentation fault - compound derived types are not acceptable function arguments paulthomas2 at wanadoo dot fr
  2004-08-09 16:03 ` [Bug fortran/16937] " pinskia at gcc dot gnu dot org
@ 2004-08-09 17:45 ` reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-09 17:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-09 17:45 -------
Here's a reduced version:

============================
program FOO
  type :: T
    character :: C(1)
  end type T

  type (T) :: X

  call BAR( X%C(:1) )
end program FOO
============================

If I replace
  call BAR( X%C(:1) )
by
  X%C(:1)='X'
I get

f951: ../../gcc/gcc/fortran/trans-expr.c:1741: gfc_trans_scalar_assign:
Assertion `lse->string_length != (tree) ((void *)0) && rse->string_length !=
(tree) ((void *)0)' failed.
lall.f90: In function `MAIN__':
lall.f90:8: internal compiler error: Aborted
Please submit a full bug report, [etc.]

If I replace the character variable by an integer variable, the code compiles
fine. Therefore I think it's a problem with character arrays and thus a dupe
of PR 15196.


*** This bug has been marked as a duplicate of 15196 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-08-09 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-09 14:22 [Bug fortran/16937] New: Compiler segmentation fault - compound derived types are not acceptable function arguments paulthomas2 at wanadoo dot fr
2004-08-09 16:03 ` [Bug fortran/16937] " pinskia at gcc dot gnu dot org
2004-08-09 17:45 ` reichelt at gcc dot gnu dot 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).