[Bug fortran/57285] New: ICe on invalid: "gfc_array_dimen_size(): Bad dimension" due to size() intrinsic with invalid dim on class() dummy argument

bugs at stellardeath dot org gcc-bugzilla@gcc.gnu.org
Wed May 15 10:18:00 GMT 2013


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

            Bug ID: 57285
           Summary: ICe on invalid: "gfc_array_dimen_size(): Bad
                    dimension" due to size() intrinsic with invalid dim on
                    class() dummy argument
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugs at stellardeath dot org

The following invalid code produces an internal error. It is invalid as it uses
size() with a dim argument of 2 that is larger than the number of dimensions of
the referred array.

> cat minimal.f90
module testmod
  type type_t
    integer :: dummy
  end type type_t
  contains
  subroutine foo(a)
    class(type_t), intent(in) :: a(:)
    type(type_t) :: c(size(a,dim=2))
  end subroutine
end module testmod
> 
> ~/sys/bin/gfortran minimal.f90 
minimal.f90:10.18:

end module testmod
                  1
Internal Error at (1):
gfc_array_dimen_size(): Bad dimension
>
> ~/sys/bin/gfortran --version
GNU Fortran (GCC) 4.9.0 20130514 (experimental)
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING


Here, ~/sys/bin/gfortran is a self-compiled gfortran from yesterday's trunk,
the ICE also happens with the gfortran 4.7.2 supplied with openSUSE:


> gfortran --version
GNU Fortran (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012]
Copyright (C) 2012 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

> gfortran minimal.f90 
minimal.f90:10.18:

end module testmod
                  1
Internal Error at (1):
gfc_array_dimen_size(): Bad dimension



This might be related to Bug #57284.



More information about the Gcc-bugs mailing list