public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58557] [OOP] Issues with CLASS/TYPE functions in array constructors: reject valid, memory leaks, invalid free
Date: Sun, 05 Jan 2014 13:39:00 -0000	[thread overview]
Message-ID: <bug-58557-4-91nfPoqFnJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58557-4@http.gcc.gnu.org/bugzilla/>

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |ice-on-valid-code

--- Comment #3 from janus at gcc dot gnu.org ---
Here is a 'corrected' version of the test case:

program main
  implicit none

   type t
   end type t

  interface
    function f_type()
      import :: t
      type(t), allocatable :: f_type
    end function
    function f_type_na()
      import :: t
      type(t) :: f_type_na
    end function
    function f_type_array()
      import :: t
      type(t), allocatable :: f_type_array(:)
    end function
    function f_type_array_na()
      import :: t
      type(t) :: f_type_array_na(5)
    end function
    function f_class(i)
      import :: t
      class(t), allocatable :: f_class
      integer :: i
    end function
    function f_class_array(i)
      import :: t
      class(t), allocatable :: f_class_array(:)
      integer :: i
    end function
    subroutine sub_type2(x)
      import :: t
      type(t) :: x(:)
    end subroutine
    subroutine sub_class2(x)
      import :: t
      class(t) :: x(:)
    end subroutine
  end interface

  type(t) :: b(1)
  integer :: i

  b = [ f_type() ]
  b = [ f_type_na() ]
  b = [ f_type_array() ]
  b = [ f_type_array_na() ]
  b = [ f_class_array(1) ]
  call sub_type2([f_class(1)])
  call sub_type2([f_class_array(1)])
  call sub_type2([(f_class(i),i=1,5)])
  call sub_type2([(f_class_array(i),i=1,5)])
  call sub_class2([f_class(1)])
  call sub_class2([f_class_array(1)])
  call sub_class2([(f_class(i),i=1,5)])
  call sub_class2([(f_class_array(i),i=1,5)])
end program main


which yields with 4.9 trunk:

c0.f90:51:0: internal compiler error: in gfc_trans_array_constructor_subarray,
at fortran/trans-array.c:1472
   b = [ f_class_array(1) ]
 ^
0x63078f gfc_trans_array_constructor_subarray
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:1472
0x63078f gfc_trans_array_constructor_value
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:1601
0x62f216 trans_array_constructor
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:2323
0x62f216 gfc_add_loop_ss_code
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:2558
0x62f955 gfc_conv_loop_setup(gfc_loopinfo*, locus*)
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:4683
0x64c001 gfc_trans_assignment_1
    /home/jweil/gcc49/trunk/gcc/fortran/trans-expr.c:7913
0x61e795 trans_code
    /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1623
0x63dee2 gfc_generate_function_code(gfc_namespace*)
    /home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:5605
0x5de510 translate_all_program_units
    /home/jweil/gcc49/trunk/gcc/fortran/parse.c:4536
0x5de510 gfc_parse_file()
    /home/jweil/gcc49/trunk/gcc/fortran/parse.c:4733
0x61adb5 gfc_be_parse_file
    /home/jweil/gcc49/trunk/gcc/fortran/f95-lang.c:188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


      parent reply	other threads:[~2014-01-05 13:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-28  7:43 [Bug fortran/58557] New: " burnus at gcc dot gnu.org
2013-09-28  7:50 ` [Bug fortran/58557] " burnus at gcc dot gnu.org
2014-01-05 12:41 ` dominiq at lps dot ens.fr
2014-01-05 13:07 ` janus at gcc dot gnu.org
2014-01-05 13:39 ` janus at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58557-4-91nfPoqFnJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).