You may have noted Fortran as a programming language has a standard and is supported by more than processor with different levels of support and guidance for practitioners. If you were to try Intel Fortran compiler in a “pedantic” mode on the code you show in the original post, you could get a response as follows:
C:\temp>ifort /c /warn:errors arithmetic_mod.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.arithmetic_mod.f90(10): error #6178: The return value of this FUNCTION has not been defined. [INT_ADD]
integer function int_add(n_1, n_2)
---------------------^
arithmetic_mod.f90(16): error #6178: The return value of this FUNCTION has not been defined. [REAL_ADD]
real function real_add(n_1, n_2)
------------------^
arithmetic_mod.f90(22): error #6178: The return value of this FUNCTION has not been defined. [COMPLEX_ADD]
complex function complex_add(n_1, n_2)
---------------------^
compilation aborted for arithmetic_mod.f90 (code 1)C:\temp>
Unfortunately with gfortran even with its “pedantic” settings, the compiler raises no alerts to bring your attention to the issue. Perhaps you can get involved with the GCC gfortran community and contribute toward compiler enhancements that can help you and other future Fortranners like you who may be using gfortran whilst learning the language:
C:\temp>gfortran -c -std=f2018 -Wpedantic -pedantic-errors arithmetic_mod.f90
C:\temp>