https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121564
--- Comment #3 from kargls at comcast dot net ---
Looks like it might be a user error.
subroutine ad_init_sub(val, output_node_ref)
real, intent(in) :: val
type(ad_node), pointer, intent(out) :: output_node_ref
...
end subroutine ad_init_sub
The above returns a pointer. So.
! 2. Crashing version (uncomment below and comment above):
print *, "MRE: Calling ad_init function..."
n1 = ad_init_func(7.0)
This assignment should likely be a pointer assignment, not an
ordinary assignment. Changing "n1 = ..." to "n1 => ad_init_func(7.0)"
allows the code to compile and execute.
With original code,
% gfcx -o z -O -Wall a1.f90 && ./z
a1.f90:143:10:
143 | n1 = ad_init_func(7.0)
| 1
Warning: POINTER-valued function appears on right-hand side of assignment at (1
[-Wsurprising]
a1.f90:143:27:
143 | n1 = ad_init_func(7.0)
| ^
Warning: 'n1' is used uninitialized [-Wuninitialized]
a1.f90:132:31:
132 | type(ad_node), pointer :: n1
| ^~
note: 'n1' was declared here
The original code also fails with flang-new.