[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 Thomas Koenig changed: What|Removed |Added Assignee|tkoenig at gcc dot gnu.org |unassigned at gcc dot gnu.org Status|ASSIGNED|NEW
[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 --- Comment #5 from Dominique d'Humieres --- > Seems fixed... I'll try to commit the test case this evening. I still get 31 | M = v_array_par(1)%MyFunc() | 1 Error: Cannot convert TYPE(mytype) to REAL(4) at (1) with module Types implicit none type MyType real :: x contains procedure :: MyFunc end type contains pure function MyFunc(this) result(M) class(MyType), intent(in) :: this real :: M M = this%x end function end module program Main use Types implicit none type(MyType), parameter :: v_array_par(1) = [ MyType(1) ] type(MyType), parameter :: v_scalar_par = MyType(1) type(MyType) :: v_array(1) real :: M M = v_array_par(1)%MyFunc() print *, M ! M = v_scalar_par%MyFunc() ! print *, M v_array(1) = MyType(1) M = v_array(1)%MyFunc() print *, M end program
[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 Thomas Koenig changed: What|Removed |Added Status|WAITING |ASSIGNED CC||tkoenig at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org --- Comment #4 from Thomas Koenig --- Seems fixed... I'll try to commit the test case this evening.
[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 --- Comment #3 from Adam Hirst --- In reference to my initial attachment 43173, and by adding the following annotations: ``` ! case 1 M = v_array_par(1)%MyFunc() print *, M ! case 2 M = v_scalar_par%MyFunc() print *, M ! case 3 v_array(1) = MyType(1) M = v_array(1)%MyFunc() print *, M ``` I would like to make clear the current status in gcc (GCC) 8.2.1 20180831 1) Case 1 only uncommented, compilation fails: ``` gfortran -fcheck=bounds -Wall -Wextra -Og -g -c "attachment2.f90" (in directory: /tmp) attachment2.f90:26:47: type(MyType), parameter :: v_array_par(1) = [ MyType(1) ] 1 Error: Can't convert TYPE(mytype) to REAL(4) at (1) Compilation failed. ``` 2) Case 2 only uncommented, works, gives expected result. 3) Case 3 only uncommented, works, gives expected result. So it seems that the problem with the Bound Procedure only occurs when the PARAMETER variable of derived type is array, not scalar.
[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 --- Comment #2 from Adam Hirst --- I don't think this is a duplicate of pr59298 because, unlike pr59298, this doesn't cause an ICE.
[Bug fortran/83927] Type-Bound Procedure on element of Derived Type PARAMETER Array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83927 Dominique d'Humieres changed: What|Removed |Added Priority|P3 |P4 Status|UNCONFIRMED |WAITING Last reconfirmed||2018-01-18 Ever confirmed|0 |1 --- Comment #1 from Dominique d'Humieres --- Confirmed from 4.8 up to trunk (8.0). Why do you think it is not a duplicate of pr59298?