[Bug fortran/99308] New: [OOP] passing array of object as class(TYPE) to procedure leads to incorrect length of array

8718033x at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 28 10:10:23 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99308

            Bug ID: 99308
           Summary: [OOP] passing array of object as class(TYPE) to
                    procedure  leads to incorrect length of array
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 8718033x at gmail dot com
  Target Milestone: ---

Created attachment 50269
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50269&action=edit
example code for generating error

If both function and subroutine takes polymorphic arrays argument, 
then the leading array(the first appear array's) length
become following array's length.

This is my first bug report. so if something wrong with it, please let me know.

version: 10.2.0
linux version: arch linux 5.11.1-arch1-1 
given option: -Og 

Example code attached.
Extra-description:
subroutine err_ver(spcs, fuel)
class(Specie) :: spcs(8), fuel(2)
...
end subroutine 

subroutine working_ver(spcs, fuel)
type(Specie) :: spcs(8), fuel(2)
..
end subroutine 

For both version, we expect that 
1. size(spcs) == 8
2. size(fuel) == 2
are true.
But, what I've got was a 8, 8 for the err_ver.
if you change the order of spcs and fuel, then you will get 2, 2


More information about the Gcc-bugs mailing list