This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 01 Apr 2018 18:33:03 +0000
- Subject: [Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator
- Auto-submitted: auto-generated
- References: <bug-85150-4@http.gcc.gnu.org/bugzilla/>
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.