Converting an expression so that it can be passed by reference could
result in a NULL pointer dereference.
2020-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>
gcc/fortran/
PR fortran/95500
* trans-expr.c (gfc_conv_expr_reference): Do not dereference NULL
pointer.
gcc/testsuite/
PR fortran/95500
* gfortran.dg/pr95500.f90: New test.
if (expr->expr_type == EXPR_FUNCTION
&& ((expr->value.function.esym
+ && expr->value.function.esym->result
&& expr->value.function.esym->result->attr.pointer
&& !expr->value.function.esym->result->attr.dimension)
|| (!expr->value.function.esym && !expr->ref
--- /dev/null
+! { dg-do compile }
+! PR fortran/95500 - ICE compiling extra interface on intrinsic
+
+program test_intrinsic
+ implicit none
+ intrinsic :: alog
+ intrinsic :: dlog
+ real (4), parameter :: one = 1
+
+ interface ln
+ procedure :: alog, dlog
+ end interface ln
+
+ write (*,*) 'ln 1', ln (one)
+end program test_intrinsic