public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44047]  New: [OOP] SELECT TYPE with associate-name and allocatable selector
@ 2010-05-09  9:35 janus at gcc dot gnu dot org
  2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-09  9:35 UTC (permalink / raw)
  To: gcc-bugs

The following test case is a modified version of the one in
http://gcc.gnu.org/ml/fortran/2009-10/msg00047.html:

implicit none
type t0
 integer :: j = 42
end type t0
type t
 integer :: i
 class(t0), allocatable :: foo
end type t
type(t) :: m
allocate(t0 :: m%foo)
m%i = 5
select type(bar => m%foo)
type is(t0)
 print *, bar
end select
end

While the original version (using allocatable CLASS arrays) still ICEs, this
one here compiles cleanly, but gives a "double free" runtime error.

The reason for this error is that we generate a local temporary for "bar",
which is auto-deallocated at the end of the SELECT TYPE block, so that the
auto-deallocation of "m%foo" fails.

The auto-deallocation of "bar" should not happen, i.e. "bar" should not have
the ALLOCATABLE attribute (currently the dump shows "struct .class.t0.a bar").


-- 
           Summary: [OOP] SELECT TYPE with associate-name and allocatable
                    selector
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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


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

* [Bug fortran/44047] [OOP] SELECT TYPE with associate-name and allocatable selector
  2010-05-09  9:35 [Bug fortran/44047] New: [OOP] SELECT TYPE with associate-name and allocatable selector janus at gcc dot gnu dot org
@ 2010-08-25 16:33 ` domob at gcc dot gnu dot org
  2010-08-26 19:50 ` domob at gcc dot gnu dot org
  2010-08-26 19:52 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-25 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from domob at gcc dot gnu dot org  2010-08-25 16:33 -------
Taking.


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |domob at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-25 16:33:36
               date|                            |


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


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

* [Bug fortran/44047] [OOP] SELECT TYPE with associate-name and allocatable selector
  2010-05-09  9:35 [Bug fortran/44047] New: [OOP] SELECT TYPE with associate-name and allocatable selector janus at gcc dot gnu dot org
  2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
@ 2010-08-26 19:50 ` domob at gcc dot gnu dot org
  2010-08-26 19:52 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-26 19:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from domob at gcc dot gnu dot org  2010-08-26 19:49 -------
Subject: Bug 44047

Author: domob
Date: Thu Aug 26 19:48:43 2010
New Revision: 163572

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163572
Log:
2010-08-26  Daniel Kraft  <d@domob.eu>

        PR fortran/38936
        PR fortran/44047
        PR fortran/45384
        * gfortran.h (struct gfc_association_list): New flag `dangling'.
        (gfc_build_block_ns): Declared here...
        * parse.h (gfc_build_block_ns): ...instead of here.
        * trans.h (gfc_process_block_locals): Expect additionally the
        gfc_association_list of BLOCK (if present).
        * match.c (select_type_set_tmp): Create sym->assoc for temporary.
        * resolve.c (resolve_variable): Only check for invalid *array*
        references on associate-names.
        (resolve_assoc_var): New method with code previously in resolve_symbol.
        (resolve_select_type): Use association to give the selector and
        temporaries their values instead of ordinary assignment.
        (resolve_fl_var_and_proc): Allow CLASS associate-names.
        (resolve_symbol): Use new `resolve_assoc_var' instead of inlining here.
        * trans-stmt.c (gfc_trans_block_construct): Pass association-list
        to `gfc_process_block_locals' to match new interface.
        * trans-decl.c (gfc_get_symbol_decl): Don't defer associate-names
        here automatically.
        (gfc_process_block_locals): Defer them rather here when linked to
        from the BLOCK's association list.

2010-08-26  Daniel Kraft  <d@domob.eu>

        PR fortran/38936
        PR fortran/44047
        PR fortran/45384
        * gfortran.dg/associate_8.f03: New test.
        * gfortran.dg/select_type_13.f03: New test.
        * gfortran.dg/select_type_14.f03: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/associate_8.f03
    trunk/gcc/testsuite/gfortran.dg/select_type_13.f03
    trunk/gcc/testsuite/gfortran.dg/select_type_14.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/parse.h
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/44047] [OOP] SELECT TYPE with associate-name and allocatable selector
  2010-05-09  9:35 [Bug fortran/44047] New: [OOP] SELECT TYPE with associate-name and allocatable selector janus at gcc dot gnu dot org
  2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
  2010-08-26 19:50 ` domob at gcc dot gnu dot org
@ 2010-08-26 19:52 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-26 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from domob at gcc dot gnu dot org  2010-08-26 19:51 -------
Fixed.


-- 

domob at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-08-26 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-09  9:35 [Bug fortran/44047] New: [OOP] SELECT TYPE with associate-name and allocatable selector janus at gcc dot gnu dot org
2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
2010-08-26 19:50 ` domob at gcc dot gnu dot org
2010-08-26 19:52 ` domob 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).