https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116656
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #1 from kargls at comcast dot net ---
The original function
function make()
class(foo), pointer :: make
make => foo_construct()
end function
compiles to (use -fdump-tree-original)
__attribute__((fn spec (". ")))
struct __class_test_Foo_p make ()
{
struct __class_test_Foo_p __result_make;
foo_construct ()._vptr->_copy (&foo_construct (), &__result_make);
return __result_make;
}
Using a result variable such as
function make() result(res)
class(foo), pointer :: res
res => foo_construct()
end function
yields
__attribute__((fn spec (". ")))
struct __class_test_Foo_p make ()
{
struct __class_test_Foo_p res;
{
struct __class_test_Foo_p D.4450;
D.4450 = foo_construct ();
res._vptr = D.4450._vptr;
res._data = D.4450._data;
}
return res;
}
So, it looks like foo_construct ()._vptr->_copy() is not actually doing
allocation and copying of results of foo_construct().