public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41582]  New: Allocation of abstract types requires a type spec or a SOURCE
@ 2009-10-05 12:53 burnus at gcc dot gnu dot org
  2009-10-08 15:39 ` [Bug fortran/41582] " burnus 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 @ 2009-10-05 12:53 UTC (permalink / raw)
  To: gcc-bugs

type, abstract :: t
  end type t
  class(t), allocatable :: a
  allocate(a)
is wrong. For the allocate one has to use either
  allocate(derived-type :: a)
or
  allocate(a, source=some_type_or_class)

One needs to reject this at compile time.

 * * *

Another interesting issue is:

type, abstract :: t
end type t
class(t), allocatable :: a,b
allocate(a, source=b)
end

That is invalid as "b" is not allocated, i.e. it does not have a dynamic type.
A check could/should be implemented at the same time as PR 41581.


-- 
           Summary: Allocation of abstract types requires a type spec or a
                    SOURCE
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          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=41582


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

* [Bug fortran/41582] Allocation of abstract types requires a type spec or a SOURCE
  2009-10-05 12:53 [Bug fortran/41582] New: Allocation of abstract types requires a type spec or a SOURCE burnus at gcc dot gnu dot org
@ 2009-10-08 15:39 ` burnus at gcc dot gnu dot org
  2009-10-09 20:34 ` burnus at gcc dot gnu dot org
  2009-10-09 20:42 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-08 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-10-08 15:39 -------
Created an attachment (id=18753)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18753&action=view)
Patch allocate(class) w/o source=/type-spec; plus PR 41581 interim fix
(completely untested)

Patch also changes the warning of allocate(...,source=class) into an error, cf.
PR 41581. Patch is untested - not even by compiling.


-- 


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


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

* [Bug fortran/41582] Allocation of abstract types requires a type spec or a SOURCE
  2009-10-05 12:53 [Bug fortran/41582] New: Allocation of abstract types requires a type spec or a SOURCE burnus at gcc dot gnu dot org
  2009-10-08 15:39 ` [Bug fortran/41582] " burnus at gcc dot gnu dot org
@ 2009-10-09 20:34 ` burnus at gcc dot gnu dot org
  2009-10-09 20:42 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-09 20:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-10-09 20:34 -------
Subject: Bug 41582

Author: burnus
Date: Fri Oct  9 20:34:35 2009
New Revision: 152601

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152601
Log:
2009-10-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41582
        * decl.c (encapsulate_class_symbol): Save attr.abstract.
        * resolve.c (resolve_allocate_expr): Reject class allocate
        without typespec or source=.
        * trans-stmt.c (gfc_trans_allocate): Change gfc_warning
        into gfc_error for "not yet implemented".

2009-10-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41582
        * gfortran.dg/class_allocate_1.f03: Modify code such that
        it compiles with the gfc_warning->gfc_error change.
        * gfortran.dg/class_allocate_1.f03: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/class_allocate_2.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/class_allocate_1.f03


-- 


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


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

* [Bug fortran/41582] Allocation of abstract types requires a type spec or a SOURCE
  2009-10-05 12:53 [Bug fortran/41582] New: Allocation of abstract types requires a type spec or a SOURCE burnus at gcc dot gnu dot org
  2009-10-08 15:39 ` [Bug fortran/41582] " burnus at gcc dot gnu dot org
  2009-10-09 20:34 ` burnus at gcc dot gnu dot org
@ 2009-10-09 20:42 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-09 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-10-09 20:42 -------
Close as FIXED.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-10-09 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-05 12:53 [Bug fortran/41582] New: Allocation of abstract types requires a type spec or a SOURCE burnus at gcc dot gnu dot org
2009-10-08 15:39 ` [Bug fortran/41582] " burnus at gcc dot gnu dot org
2009-10-09 20:34 ` burnus at gcc dot gnu dot org
2009-10-09 20:42 ` burnus 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).