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



Paul Thomas <pault at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2012-12-16

                 CC|                            |pault at gcc dot gnu.org

         AssignedTo|unassigned at gcc dot       |pault at gcc dot gnu.org

                   |gnu.org                     |

     Ever Confirmed|0                           |1



--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> 2012-12-16 15:27:24 
UTC ---

trans-expr.c:203



tree

gfc_get_vptr_from_expr (tree expr)

{

  tree tmp = expr;

  while (tmp && !GFC_CLASS_TYPE_P (TREE_TYPE (tmp)))

    tmp = TREE_OPERAND (tmp, 0);

  tmp = gfc_class_vptr_get (tmp);

  return tmp;

}



is changed to



tree

gfc_get_vptr_from_expr (tree expr)

{

  tree tmp = expr;

  while (tmp && !GFC_CLASS_TYPE_P (TREE_TYPE (tmp))

     && !(TYPE_CANONICAL (TREE_TYPE (tmp))

          && GFC_CLASS_TYPE_P (TYPE_CANONICAL (TREE_TYPE (tmp)))))

    tmp = TREE_OPERAND (tmp, 0);

  tmp = gfc_class_vptr_get (tmp);

  return tmp;

}



the bug is fixed.  The array reference seems to spin a new TREE_TYPE for the

class container that does not get marked as GFC_CLASS_TYPE_P.  I have no idea

why or what might have changed it.



As soon as I get the unlimited polymorphic patch committed, I will submit this

as a patch with the testcase:



program test

  implicit none

  type :: ncBhStd

    integer :: i

  end type

  type :: tn

    class (ncBhStd), allocatable, dimension(:) :: cBh

  end type

  integer :: i

  type(tn), target :: a

  allocate (a%cBh(2), source = [(ncBhStd(i*99), i = 1,2)])

  select type (q => a%cBh(1))

    type is (ncBhStd)

      if (q%i .ne. 99) call abort

  end select



end

Reply via email to