Created attachment 42268 [details] Code showing the bug Allocating procedure gets called twice (and leaks) using -fcheck=pointer $ gfortran -cpp ./bug.f90 $ ./a.out ****** typea_new 3.14000010 $ gfortran -DNOBUG -cpp -fcheck=pointer ./bug.f90 $ ./a.out ****** typea_new 3.14000010 $ gfortran -cpp -fcheck=pointer ./bug.f90 $ ./a.out ****** typea_new ****** typea_new 3.14000010 $ gfortran --version GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. $ gfortran --version GNU Fortran (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. Best regards, José Rui
Confirmed from 4.5 up to trunk (8.0). -fcheck=pointer is not available in 4.4.
Patch posted: https://gcc.gnu.org/pipermail/fortran/2021-April/055973.html
Fixed on mainline for gcc-12, 11-branch and 10-branch. Best regards, José Rui