This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/52265] New: [OOP] TREE dump confusing with nested SELECT TYPE


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

             Bug #: 52265
           Summary: [OOP] TREE dump confusing with nested SELECT TYPE
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: pault@gcc.gnu.org


The following program seems to work as expected, however, the dump is very
irritating:

        switch (a._vptr->_hash)
          {
            case 6231989:;
            __tmp_type_t = a._data;
            {
              struct t * __tmp_type_t;

              switch (b._vptr->_hash)
                {
                  case 6231989:;
                  __tmp_type_t = b._data;
                  *__tmp_type_t = *__tmp_type_t;

There are two variables called "__tmp_type_t", one pointing to a._data and the
other to b._data. Most striking is the last line where both variables occur.
That's very confusing and would be impossible to do in C, C++, or Fortran.

Expected: Use different variable names, e.g. via
  gfc_create_var (type, "__tmp_type_t")


type t
  integer :: i = 5
end type t

class(t), allocatable :: a, b

allocate(a,b)
b%i = 77
select type (a)
  type is (t)
   select type (b)
     type is (t)
       a = b
       b%i = 88
   end select
end select
if (a%i /= 77) call abort ()
if (a%i /= 88) call abort ()
end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]