public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janus Weil <janus@gcc.gnu.org>
To: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [Patch, Fortran] PR 41800: [OOP] ICE in fold_convert_loc, at  	fold-const.c:2789
Date: Fri, 23 Oct 2009 14:52:00 -0000	[thread overview]
Message-ID: <854832d40910230727x7096a304if1faf48b2b515214@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Hi all,

here is a one-line fix for another OOP problem, connected to
CLASS-valued functions.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2009-10-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41800
	* trans-expr.c (gfc_trans_scalar_assign): Handle CLASS variables.


2009-10-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41800
	* gfortran.dg/class_10.f03: New test.

[-- Attachment #2: pr41800.diff --]
[-- Type: text/x-diff, Size: 518 bytes --]

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 153496)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -4660,7 +4660,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rs
 	  gfc_add_expr_to_block (&block, tmp);
 	}
     }
-  else if (ts.type == BT_DERIVED)
+  else if (ts.type == BT_DERIVED || ts.type == BT_CLASS)
     {
       gfc_add_block_to_block (&block, &lse->pre);
       gfc_add_block_to_block (&block, &rse->pre);

[-- Attachment #3: class_10.f03 --]
[-- Type: application/octet-stream, Size: 628 bytes --]

! { dg-do compile }
!
! PR 41800: [OOP] ICE in fold_convert_loc, at fold-const.c:2789
!
! Contributed by Harald Anlauf <anlauf@gmx.de>

module abstract_gradient

  implicit none
  private

  type, public, abstract :: gradient_class
  contains
    procedure, nopass  :: inner_product
  end type

contains

  function inner_product ()
    class(gradient_class), pointer :: inner_product
    inner_product => NULL()
  end function

end module


 use abstract_gradient
 class(gradient_class), pointer    :: g_initial, ip_save
 ip_save => g_initial%inner_product()   ! ICE
end

! { dg-final { cleanup-modules "abstract_gradient" } }

             reply	other threads:[~2009-10-23 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 14:52 Janus Weil [this message]
2009-10-23 15:09 ` Jerry DeLisle
2009-10-23 16:21   ` Janus Weil

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=854832d40910230727x7096a304if1faf48b2b515214@mail.gmail.com \
    --to=janus@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).