public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55850] New: [OOP] SELECT TYPE issues
Date: Wed, 02 Jan 2013 22:43:00 -0000	[thread overview]
Message-ID: <bug-55850-4@http.gcc.gnu.org/bugzilla/> (raw)


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

             Bug #: 55850
           Summary: [OOP] SELECT TYPE issues
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: pault@gcc.gnu.org


a) Accepts invalid with coindexed variables. Fortran 2008:

R804  association  is  associate-name => selector
R805  selector  is  expr
                or  variable
C801 (R804) If selector is not a variable or is a variable that has a vector
subscript, associate-name shall not appear in a variable definition context
(16.6.7).
C802 (R804) An associate-name shall not be the same as another associate-name
in the same associate-stmt.
C803 (R805) variable shall not be a coindexed object.
C804 (R805) expr shall not be a variable.


I think that prohibits:
  associate (myname => coarray[i])

For ASSOCIATE, one gets:

associate (x => caf[4])
                      1
Error: Association target at (1) must not be coindexed


But for SELECT TYPE, it is accepted:

module gn
  type :: ncb
  end type ncb
  type, public :: tn
     class(ncb), allocatable :: cb(:)[:]
  end type tn
contains
  integer function name(self)
    implicit none
    class (tn), intent(in) :: self
    select type (component => self%cb(1)[4])  ! INVALID due to the "[4]"
    end select
  end function name
end module gn


Note: The problem is not the coarray, just the coindex (gfc_is_coindexed).



b) ICE with the following:
    select type (t = self%cb)
Note the "=" opposed to "=>". Backtrace:

0x5e32d0 gfc_undo_symbols()
        ../../gcc/fortran/symbol.c:2972
0x5af3aa reject_statement
        ../../gcc/fortran/parse.c:1747
0x5af4dc match_word
        ../../gcc/fortran/parse.c:72


module gn
  type :: ncb
  end type ncb
  type, public :: tn
     class(ncb), allocatable :: cb
  end type tn
contains
  integer function name(self)
    implicit none
    class (tn), intent(in) :: self
    select type (t = self%cb)
    end select
  end function name
end module gn



c) The following also ICEs:

0x5cd395 resolve_select_type
        ../../gcc/fortran/resolve.c:7791
0x5cd395 resolve_code
        ../../gcc/fortran/resolve.c:9707


module gn
  type :: ncb
  end type ncb
  type, public :: tn
     type(ncb), allocatable :: cb
  end type tn
contains
  integer function name(self)
    implicit none
    class (tn), intent(in) :: self
    select type (t => self%cb)
    type is (ncb)
        t = 5
    end select
  end function name
end module gn


             reply	other threads:[~2013-01-02 22:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 22:43 burnus at gcc dot gnu.org [this message]
2013-01-02 22:46 ` [Bug fortran/55850] " burnus at gcc dot gnu.org
2014-03-22 14:42 ` dominiq at lps dot ens.fr
2014-05-02 11:31 ` burnus at gcc dot gnu.org

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-55850-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).