User account creation filtered due to spam.
Follow up to PR 49106.
There should be the possibility to tie (nested) constructors to a variable (of the parent function), such that the constructor is optimized away if the parent function is optimized way.
Fortran example (with -fcoarray=lib):
integer :: a[*]
a = 8
end program main
Here, "foo()" is never called. With -fcoarray=lib gfortran creates a constructor function to register the coarray "a" with the library. The constructor is nested in "foo" - and obviously not needed if the function (or the variable "a") is optimized away.
Expected: By tying the constructor to the variable, the constructor can be optimized away if the variable is needed.
Dump of the Fortran program above:
a = (integer(kind=4) * restrict)
_gfortran_caf_register (4, 0, &caf_token.0, 0B, 0B, 0);
static void * caf_token.0;
static integer(kind=4) * restrict a;
void _caf_init.1 (void);
*a = 8;