Skip to content

Commit 00acae2

Browse files
authored
fix #233 - make factories impure (#234)
fixes #233 Pure functions get_activation_by_name and get_optimizer_by_name construct polymorphic function results. Removing `pure` enables building with the LLVM flang-new compiler. Although Fortran 2003 allowed pure functions with allocatable polymorphic results, subsequent standards disallowed such functions. Using this Fortran 2003 feature blocks building with the LLVM and NAG compilers and likely will block building with future versions of gfortran once GCC issue 78640 has been fixed. (See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78640.) TODO: A subsequent error still blocks building with NAG, which this commit does not address.
1 parent 3049393 commit 00acae2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/nf/nf_activation.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ pure function eval_3d_celu_prime(self, x) result(res)
733733
end function eval_3d_celu_prime
734734

735735
! Utility Functions
736-
pure function get_activation_by_name(activation_name) result(res)
736+
function get_activation_by_name(activation_name) result(res)
737737
character(len=*), intent(in) :: activation_name
738738
class(activation_function), allocatable :: res
739739

src/nf/nf_optimizers.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ end subroutine minimize_adagrad
316316

317317
! Utility Functions
318318
!! Returns the default optimizer corresponding to the provided name
319-
pure function get_optimizer_by_name(optimizer_name) result(res)
319+
function get_optimizer_by_name(optimizer_name) result(res)
320320
character(len=*), intent(in) :: optimizer_name
321321
class(optimizer_base_type), allocatable :: res
322322

0 commit comments

Comments
 (0)