public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44616]  New: [OOP] ICE if CLASS(foo) is used before its definition
@ 2010-06-21 16:43 burnus at gcc dot gnu dot org
  2010-06-21 18:30 ` [Bug fortran/44616] " janus at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-21 16:43 UTC (permalink / raw)
  To: gcc-bugs

Reported by bd satish at http://gcc.gnu.org/ml/fortran/2010-06/msg00210.html

For the program, gfortran ICEs with:
  f951: internal compiler error: in find_typebound_proc_uop, at
  fortran/class.c:660

The failing assert is:
  gcc_assert (derived->f2k_derived);

Note: The original test case (see link) misses an IMPORT, cf. PR 44614.

The additional derived type is required -- and for the ICE it needs to come
before the actual definition, otherwise, it works.

module factory_pattern
implicit none

type First_Factory
    character(len=20) :: factory_type
    class(Connection), pointer :: connection_type
    contains
end type First_Factory

type, abstract :: Connection
    contains
    procedure(generic_desc), deferred :: description
end type Connection

abstract interface
    subroutine generic_desc(self)
        import  ! Required, cf. PR 44614
        class(Connection) :: self
    end subroutine generic_desc
end interface
end module factory_pattern


-- 
           Summary: [OOP] ICE if CLASS(foo) is used before its definition
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/44616] [OOP] ICE if CLASS(foo) is used before its definition
  2010-06-21 16:43 [Bug fortran/44616] New: [OOP] ICE if CLASS(foo) is used before its definition burnus at gcc dot gnu dot org
@ 2010-06-21 18:30 ` janus at gcc dot gnu dot org
  2010-06-22 17:07 ` janus at gcc dot gnu dot org
  2010-06-22 17:09 ` janus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-21 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2010-06-21 18:30 -------
Here is a fix:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 161045)
+++ gcc/fortran/resolve.c       (working copy)
@@ -11136,6 +11136,7 @@ resolve_fl_derived (gfc_symbol *sym)
   /* If this is a non-ABSTRACT type extending an ABSTRACT one, ensure that
      all DEFERRED bindings are overridden.  */
   if (super_type && super_type->attr.abstract && !sym->attr.abstract
+      && !sym->attr.is_class
       && ensure_not_abstract (sym, super_type) == FAILURE)
     return FAILURE;



-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-06-21 18:30:07
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/44616] [OOP] ICE if CLASS(foo) is used before its definition
  2010-06-21 16:43 [Bug fortran/44616] New: [OOP] ICE if CLASS(foo) is used before its definition burnus at gcc dot gnu dot org
  2010-06-21 18:30 ` [Bug fortran/44616] " janus at gcc dot gnu dot org
@ 2010-06-22 17:07 ` janus at gcc dot gnu dot org
  2010-06-22 17:09 ` janus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-22 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2010-06-22 17:07 -------
Subject: Bug 44616

Author: janus
Date: Tue Jun 22 17:07:06 2010
New Revision: 161208

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161208
Log:
2010-06-22  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/44616
        * resolve.c (resolve_fl_derived): Avoid checking for abstract on class
        containers.

2010-06-22  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/44616
        * gfortran.dg/abstract_type_8.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/abstract_type_8.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/44616] [OOP] ICE if CLASS(foo) is used before its definition
  2010-06-21 16:43 [Bug fortran/44616] New: [OOP] ICE if CLASS(foo) is used before its definition burnus at gcc dot gnu dot org
  2010-06-21 18:30 ` [Bug fortran/44616] " janus at gcc dot gnu dot org
  2010-06-22 17:07 ` janus at gcc dot gnu dot org
@ 2010-06-22 17:09 ` janus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-22 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2010-06-22 17:09 -------
Fixed with r161208. Closing.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-22 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 16:43 [Bug fortran/44616] New: [OOP] ICE if CLASS(foo) is used before its definition burnus at gcc dot gnu dot org
2010-06-21 18:30 ` [Bug fortran/44616] " janus at gcc dot gnu dot org
2010-06-22 17:07 ` janus at gcc dot gnu dot org
2010-06-22 17:09 ` janus at gcc dot gnu dot org

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