https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82995 --- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- OK! I have overlooked the line logical, intent(in), optional :: mask(:) in my_sum and it rung some bell. This PR is related to/duplicate of pr67277.