Gfortran does not like me forgetting () on function calls. Simple test code: module ice implicit none contains subroutine in_the logical :: there_is there_is = sunshine ! () are missing! end subroutine function sunshine() logical :: sunshine sunshine = .true. end function end module $ LANG=C gfortran -c -o gccice.o gccice.f90 gccice.f90: In function 'in_the': gccice.f90:17: internal compiler error: in gfc_conv_variable, at fortran/trans-expr.c:483 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
I can reproduce the ICE with 4.1, 4.2 and 4.3 - but it no longer gives an ICE with 4.4 or 4.5. * * * However, there is also a bug in 4.4: It simply compiles. Expected: Either an error of the form (NAG f95) Error: aa.f90, line 6: Implicit type for SUNSHINE detected at SUNSHINE@<end-of-statement> or -- better (or additionally) -- of the form error #6423: This name has already been used as an external function name. [SUNSHINE] * * * In 4.3.4 the following assert fails: /* Procedure actual arguments. */ else if (sym->attr.flavor == FL_PROCEDURE && se->expr != current_function_decl) { gcc_assert (se->want_pointer);
> However, there is also a bug in 4.4: It simply compiles. But if one adds a "print *, there_is", one sees that it does not work (wrong result, independent of sunshine()!)
The program is still accepted without error with 4.6 and 4.7 trunk. However, print *,sunshine triggers the expected error: print *,sunshine 1 Error: Function 'sunshine' requires an argument list at (1)
No ICE with versions configured with --enable-checking=yes or =release. $ cat z1.f90 module m implicit none contains subroutine s logical :: f f = g !() end logical function g() g = .true. end end $ gfortran-9-20181021-chk -c z1.f90
Following program compiles smoothly and runs ... Invocations of function h need obligatoric parenthesis, and a dummy. On the other hand, "implicit none" would force variable h to be explicitly declared. $ cat z2.f90 module m implicit none contains logical function f() f = h end function logical function g() g = .not. h end function logical function h(x) logical, intent(in) :: x h = .not. x end function end program p use m print *, f() print *, g() ! .not. f() end $ gfortran-9-20181021-chk -Wall -Wextra -fcheck=all -static-libgfortran -g z2.f90 $ a.out F F