public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57710] [OOP] _vptr not set for allocatable CLASS components
       [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-25 17:11 ` dominiq at lps dot ens.fr
  2013-07-31  7:46 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-25 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-06-25
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed.


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

* [Bug fortran/57710] [OOP] _vptr not set for allocatable CLASS components
       [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
  2013-06-25 17:11 ` [Bug fortran/57710] [OOP] _vptr not set for allocatable CLASS components dominiq at lps dot ens.fr
@ 2013-07-31  7:46 ` janus at gcc dot gnu.org
  2013-07-31  7:51 ` [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-07-31  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #0)
> The following code (minus the IF condition) shows that _vptr is not set for
> the allocatable component:
>         y.x._data = 0B;
> there should be - but isn't - additionally: y.x._vptr = &__vtab_m_T;

Without the BLOCK, the dump shows:

  static struct t2 y = {.x={._vptr=&__vtab_m_T}};

  y.x._data = 0B;
  y.ii = 123;

while with the BLOCK one gets:

    struct t2 y;

    try
      {
        y.x._data = 0B;
        y.ii = 123;
        L.1:;
      }

Can't we do a 'static' initialization (of _vptr *and* _data) in both cases? As
in

  struct t2 y = {.x={._vptr=&__vtab_m_T,._data = 0B}}

For this gfc_class_null_initializer (from class.c) could be used ...


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

* [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK
       [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
  2013-06-25 17:11 ` [Bug fortran/57710] [OOP] _vptr not set for allocatable CLASS components dominiq at lps dot ens.fr
  2013-07-31  7:46 ` janus at gcc dot gnu.org
@ 2013-07-31  7:51 ` janus at gcc dot gnu.org
  2013-07-31 19:15 ` janus at gcc dot gnu.org
  2013-08-01 20:40 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-07-31  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[OOP] _vptr not set for     |[OOP] [F08] _vptr not set
                   |allocatable CLASS           |for allocatable CLASS
                   |components                  |component inside BLOCK

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #0)
> Additionally, the test case as is (with IF condition), currently crashes
> with:
> 
> internal compiler error: in gfc_conv_component_ref, at
> fortran/trans-expr.c:1654

Also the ICE occurs only with the BLOCK construct. Slightly reduced test case:

module m
  type t
  end type
  type t2
    class(t), allocatable :: x
  end type
end module

use m
type(t) :: z
block
  type(t2) :: y
  if (.not. same_type_as(y%x, z)) call abort ()
end block
end


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

* [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK
       [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-07-31  7:51 ` [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK janus at gcc dot gnu.org
@ 2013-07-31 19:15 ` janus at gcc dot gnu.org
  2013-08-01 20:40 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-07-31 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> Can't we do a 'static' initialization (of _vptr *and* _data) in both cases?
> As in
> 
>   struct t2 y = {.x={._vptr=&__vtab_m_T,._data = 0B}}
> 
> For this gfc_class_null_initializer (from class.c) could be used ...

... we would just have to enable this for the BLOCK case in gfc_get_symbol
decl. However, I'm not sure if this is really the way to go.

Otherwise, one should do the (non-static) initialization of the _vptr via
gfc_nullify_alloc_comp.


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

* [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK
       [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-07-31 19:15 ` janus at gcc dot gnu.org
@ 2013-08-01 20:40 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-08-01 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to janus from comment #2)
> Can't we do a 'static' initialization (of _vptr *and* _data) in both cases?

Well, you need to free and finalize the variable - hence, it cannot be static.


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

end of thread, other threads:[~2013-08-01 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-57710-4@http.gcc.gnu.org/bugzilla/>
2013-06-25 17:11 ` [Bug fortran/57710] [OOP] _vptr not set for allocatable CLASS components dominiq at lps dot ens.fr
2013-07-31  7:46 ` janus at gcc dot gnu.org
2013-07-31  7:51 ` [Bug fortran/57710] [OOP] [F08] _vptr not set for allocatable CLASS component inside BLOCK janus at gcc dot gnu.org
2013-07-31 19:15 ` janus at gcc dot gnu.org
2013-08-01 20:40 ` burnus at gcc dot gnu.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).