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

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Nathan T. Weeks from comment #0)
> 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
> 
> C461 (R443) The designator shall designate a nonallocatable variable
> that has the TARGET and SAVE attributes 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.

Oddly, someone added code to check for only a portion of the
constraint in expr.c(gfc_check_assign_symbol).  At line 4046,
we find

      /* F08:C461. Additional checks for pointer initialization.  */

In fact it only checks for TARGET and SAVE.  A little sleuthing
shows the code came into the tree with r163356.

Reply via email to