Hi,

This is my first bug report, so apologies if I haven’t given sufficient 
information. If so, let me know what else is needed.

Please find details below.

Kind regards,
Ned

Error message during compilation:
test_error.f90:29:33:

   29 |     ptr => this%get_partial(grad)
      |                                 1
internal compiler error: in fold_convert_loc, at fold-const.cc:2633
0x11c23082a1c9 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x11c23082a28a __libc_start_main_impl
        ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using 
-freport-bug).

Command line that caused the error:
gfortran test_error.f90

Versions tested on (GCC and system):
- GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
- GNU Fortran (Ubuntu 14.2.0-4ubunit2~24.04) 14.2.0
- GNU Fortran (Homebrew GCC 15.2.0) 15.2.0 - MacOS 15.6.1

Options given when gcc was configured/built:
- For MacOS, built using `brew install gcc`
- For Ubuntu, built using `deb gfortran-14`

Example code that encounters the error:
- Module and program can be in the same or a separate file for the error to 
occur
- For my report, I have put it all in one file called `test_error.f90`
- File also attached

module test_error
implicit none

type :: array_type
procedure(get_partial_ptr), pass(this), pointer :: get_partial => null()
contains
procedure, pass(this) :: grad_reverse
end type array_type

interface
module function get_partial_ptr(this, upstream_grad) result(output)
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad
type(array_type), pointer :: output
end function get_partial_ptr
end interface

contains

function grad_reverse(this, grad) result(output)
implicit none
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: grad
type(array_type) :: output

type(array_type), pointer :: ptr

! Example implementation of getting the partial derivative
ptr => this%get_partial(grad)

output = ptr

end function grad_reverse


end module test_error

program test
use test_error
implicit none


type(array_type) :: a, b, c

! Example usage
c = a%grad_reverse(b)

contains

end program test

Attachment: test_error.f90
Description: test_error.f90

Reply via email to