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/54992] New: [OOP] Wrong offset in the array offset calculation when using nonclass%class(index)%nonclass


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

             Bug #: 54992
           Summary: [OOP] Wrong offset in the array offset calculation
                    when using nonclass%class(index)%nonclass
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org, pault@gcc.gnu.org


As reported by Andrew Benson in the thread starting at
http://gcc.gnu.org/ml/fortran/2012-10/msg00087.html

The problem is that gfortran generates the wrong code for:

    targetNode%cBh(2)%hostNode => targetNode

where "cBh" is a polymorphic array. The offset is calculated as

  ((base_type *)targetNode->_data->cBh->_data)[ index ].host


Instead of the proper:

  targetNode->_data->cBh->_data.data
               + (index * targetNode->_data->cBh->_vptr_size)


Test case:  http://gcc.gnu.org/ml/fortran/2012-10/msg00100.html

Analysis:   http://gcc.gnu.org/ml/fortran/2012-10/msg00101.html


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