public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, fortran] [4.7/4.8 Regression] [OOP] ICE on invalid: gfc_variable_attr(): Bad array reference
Date: Wed, 02 Jan 2013 14:56:00 -0000	[thread overview]
Message-ID: <50E44A88.1050508@net-b.de> (raw)
In-Reply-To: <CAGkQGi+sXPGMabT_-ZGVAgu+LJ6JwMMXvJnLuizB+5CJeVn1dg@mail.gmail.com>

Dear Paul,

Paul Richard Thomas wrote:
> As noted by Janus in comment #2 of the PR, "I think the function
> 'copy_ts_from_selector_to_associate' comes too early (namely during
> parsing). It tries to resolve the target expr, which should rather
> wait until resolution stage!?!"
>
> It turned out that the function of the call to gfc_resolve_expr was to
> fix up the selector array reference type.  This has been done
> explicitly in this patch.
>
> Bootstraps and regtests on FC17/x86_64 - OK for trunk and 4.7?

It looks mostly okay; however, you do not handle vector sections 
correctly, which leads to an ICE. Without your patch, one gets:
    Error: CLASS selector at (1) needs a temporary which is not yet 
implemented

With your patch, it fails as one has:
(gdb) p ref->next->u.ar.type
$7 = AR_ELEMENT

(gdb) p ref->next->u.ar.dimen_type
$8 = {DIMEN_VECTOR, 0, 0, 0, 0, 0, 0}

Please fix the DIMEN_VECTOR handling and add a test case for it (e.g. 
the one below). Could you also check whether we have a PR for that "not 
yet implemented" error?

module gn
   type :: ncb
   end type ncb
   type, public :: tn
      class(ncb), allocatable, dimension(:) :: cb
   end type tn
contains
   integer function name(self)
     implicit none
     class (tn), intent(in) :: self
     select type (component => self%cb([4,7+1]))
     end select
   end function name
end module gn


I am not quite sure whether the following ICE has the same cause or a 
different one, but it also ICEs with your patch applied:

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[4])
! ALSO FAILS: "(component => self%cb)"
     end select
   end function name
end module gn



Tobias

  reply	other threads:[~2013-01-02 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 14:11 Paul Richard Thomas
2013-01-02 14:56 ` Tobias Burnus [this message]
2013-01-02 21:33   ` Paul Richard Thomas
2013-01-02 22:48     ` Tobias Burnus
2013-01-04 17:46       ` Paul Richard Thomas
2013-01-04 20:54       ` Paul Richard Thomas

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=50E44A88.1050508@net-b.de \
    --to=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    /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).