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

            Bug ID: 85150
           Summary: internal compiler error for module with illegal
                    non-constant pointer initialization designator
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: weeks at iastate dot edu
  Target Milestone: ---

The following module code results in an internal compiler error with gfortran
7.3.0:

==================================================================
$ cat mod_test.f90 
module mod_test
   implicit none
   integer, target :: buf(2)
   integer :: buf_i = 1
   integer, pointer :: buf_ptr => buf(buf_i) ! invalid
end module mod_test
$ gfortran-mp-7  mod_test.f90
f951: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1058

f951: internal compiler error: Abort trap: 6
gfortran-mp-7: internal compiler error: Abort trap: 6 (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
$ gfortran-mp-7 --version 
GNU Fortran (MacPorts gcc7 7.3.0_0) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
==================================================================

This code is apparently invalid, but a helpful error message would be
preferable to an internal compiler error. Compile-time errors from the Intel
Fortran 18.0.1 and Cray Fortran 8.6.2 seem to indicate that the preceding code
violates the following paragraph in the Fortran 2008 standard:

C461 (R443) The designator shall designate a nonallocatable variable that has
the TARGET and SAVE attri-
            butes and does not have a vector subscript. Every subscript,
section subscript, substring starting point,
            and substring ending point in designator shall be a constant
expression.

Reply via email to