https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119800
--- Comment #5 from kargls at comcast dot net --- (In reply to anlauf from comment #4) > (In reply to Keith Refson from comment #3) > > I think it probably also needs to flag up if MOLD contains an allocatable or > > pointer component too. Modifying the example to TRANSFER to an integer, > > followed by a second TRANSFER with SOURCE= as an integer array and MOLD as > > the type, should warn on both instances. > > Indeed, the problem is MOLD, not SOURCE. Yeah, Keith is correct in that the patch should also check MOLD. gfortran's behavior with TRANSFER, I believe, matches the requirements of the Fortran standard. F2023, 16.9.212 talks about physical representation of SOURCE and MOLD. We're copying the physical address of the allocated memory and perhaps a dope vector instead of doing a deep copy. We probably want to key the warning off of -Wall instead of -Wsurprising. I suspect more people use the former, and thus, will see the warning.