public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ghasemi.arash at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60477] New: unlimited type class(*) not working properly
Date: Sun, 09 Mar 2014 21:18:00 -0000	[thread overview]
Message-ID: <bug-60477-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 60477
           Summary: unlimited type class(*) not working properly
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ghasemi.arash at gmail dot com

Created attachment 32320
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32320&action=edit
source file

hey folks. I couldn't use an unlimited pointer  "class(*), pointer" inside a
procedure. here I've got a simple module that has a base data type named "ex1"
and a child type "ex2" that extends "ex1". 
================================================================
module oop2
  implicit none

  private

  type ex1
     integer :: a
  end type ex1

  type, extends(ex1) :: ex2
     real*8 :: b
  end type ex2

  public :: ex1, ex2, printit

contains

  subroutine printit(ex)
    implicit none
    class(ex1), target, intent(in) :: ex

    ! local vars                                                                
    class(*), pointer :: pnt => null()

    pnt => ex ! buggy :(                                                        

  end subroutine printit

end module oop2
================================================================

   The problem arises inside "printit" procedure. When I defined the unlimited
pointer "class(*), pointer :: pnt" it cause no problem and code compiles fine
with gfortran 4.8.1. However when I start pointing to the subroutine's dummy
argument "ex" I get the following error:

================================================================
new_bug.f90:31:0: internal compiler error: Segmentation fault
 end module oop2
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
================================================================    

This code compiles fine with ifort. Here is the main program that I used

================================================================
program test
  use oop2
  implicit none

  type(ex1) :: b
  b%a = 2

  call printit(b)

  ! done here                                                                   

end program test
================================================================

The intel compiler also works fine with polymorphic data when I use different
type for variable "b" defined in the main program like "type(ex2) :: b". Thanks


             reply	other threads:[~2014-03-09 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-09 21:18 ghasemi.arash at gmail dot com [this message]
2014-03-09 21:29 ` [Bug fortran/60477] " kargl at gcc dot gnu.org
2014-03-22 21:42 ` dominiq at lps dot ens.fr

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-60477-4@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).