[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2022-01-15 Thread weeks at iastate dot edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

--- Comment #7 from Nathan Weeks  ---
Great, thanks!

--
Nathan


On Sat, Jan 15, 2022 at 4:11 PM anlauf at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150
>
> anlauf at gcc dot gnu.org changed:
>
>What|Removed |Added
>
> 
>  Status|NEW |RESOLVED
>  Resolution|--- |DUPLICATE
>
> --- Comment #6 from anlauf at gcc dot gnu.org ---
> This is indeed fixed by commit r12-6387.  Closing.
>
> Thanks for the report!
>
> *** This bug has been marked as a duplicate of bug 101762 ***
>
> --
> You are receiving this mail because:
> You reported the bug.

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2022-01-15 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #6 from anlauf at gcc dot gnu.org ---
This is indeed fixed by commit r12-6387.  Closing.

Thanks for the report!

*** This bug has been marked as a duplicate of bug 101762 ***

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2022-01-14 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #5 from anlauf at gcc dot gnu.org ---
This seems to have been recently fixed on mainline for gcc-12.

Likely fix: r12-6387 for pr101762.

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2018-04-01 Thread kargl at gcc dot gnu.org
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.

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2018-04-01 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

--- Comment #3 from Dominique d'Humieres  ---
The code compiles if I replace

   integer :: buf_i = 1

with

   integer, parameter :: buf_i = 1

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2018-04-01 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> I get the ICE with 4.8 up to trunk (8.0). Compiling the test with 4.3.6
> gives the error
> 
>integer, pointer :: buf_ptr => buf(buf_i) ! invalid
>  1
> Error: Pointer initialization requires a NULL() at (1)

4.3.6 did not support pointer initialization to anything
other than a null-init as 4.3.6 did not support Fortran
2008.  With Fortran 2008, it is legal to do 

integer, target :: m
integer, pointer :: n => m

I haven't looked too closely at Nathan's code, but it
may be invalid as buf_i is not a constant expression.

That is,

module mod_test
   implicit none
   integer, target :: buf(2)
   integer :: buf_i = 1

The above is not a named constant,

   integer, pointer :: buf_ptr => buf(buf_i) ! invalid

so it may not be valid Fortran to reference it here in
a specification statement.

end module mod_test

[Bug fortran/85150] internal compiler error for module with illegal non-constant pointer initialization designator

2018-04-01 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85150

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-04-01
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
I get the ICE with 4.8 up to trunk (8.0). Compiling the test with 4.3.6 gives
the error

   integer, pointer :: buf_ptr => buf(buf_i) ! invalid
 1
Error: Pointer initialization requires a NULL() at (1)