Bug 82376 - Duplicate function call using -fcheck=pointer
Summary: Duplicate function call using -fcheck=pointer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P4 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2017-09-30 16:36 UTC by José Rui Faustino de Sousa
Modified: 2021-06-16 01:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-09-30 00:00:00


Attachments
Code showing the bug (891 bytes, text/plain)
2017-09-30 16:36 UTC, José Rui Faustino de Sousa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description José Rui Faustino de Sousa 2017-09-30 16:36:37 UTC
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
Comment 1 Dominique d'Humieres 2017-09-30 20:48:01 UTC
Confirmed from 4.5 up to trunk (8.0). -fcheck=pointer is not available in 4.4.
Comment 2 José Rui Faustino de Sousa 2021-04-22 18:12:20 UTC
Patch posted:

https://gcc.gnu.org/pipermail/fortran/2021-April/055973.html
Comment 3 José Rui Faustino de Sousa 2021-06-16 01:03:18 UTC
Fixed on mainline for gcc-12, 11-branch and 10-branch.

Best regards,
José Rui