Bug 61765 - [7/8/9 Regression] [F03] Rejects valid BIND(C) ENTRY
Summary: [7/8/9 Regression] [F03] Rejects valid BIND(C) ENTRY
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 5.0
: P4 normal
Target Milestone: 9.0
Assignee: kargls
URL:
Keywords: rejects-valid
Depends on:
Blocks: ISO_C_Binding
  Show dependency treegraph
 
Reported: 2014-07-09 22:33 UTC by Francois-Xavier Coudert
Modified: 2019-02-23 13:16 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-07-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2014-07-09 22:33:52 UTC
gfortran 4.9 and 4.10 reject the code below with:

   subroutine sub(x)
     integer, intent(in) :: x
     entry sub_c(x) bind(c)
   end subroutine sub

a.f90:3.16-16:

     entry sub_c(x) bind(c)
                12
Error: Procedure sub_c with binding label sub_c at (1) uses the same global identifier as entity at (2)


As far as I can tell, this code is standard-conforming (related to non-legal code from PR 35031). It should be accepted.
Comment 1 Dominique d'Humieres 2014-07-09 22:58:23 UTC
The code is accepted up to r199034 (2013-05-17) and rejected after r199221 (2013-05-22). Likely r199118, r199119, or r199120 (pr 48858).
Comment 2 Dominique d'Humieres 2015-02-16 09:55:06 UTC
> The code is accepted up to r199034 (2013-05-17) and rejected after r199221
> (2013-05-22). Likely r199118, r199119, or r199120 (pr 48858).

It is r199120.
Comment 3 Jakub Jelinek 2015-06-26 19:56:55 UTC
GCC 4.9.3 has been released.
Comment 4 Richard Biener 2016-08-03 11:41:19 UTC
GCC 4.9 branch is being closed
Comment 5 Jakub Jelinek 2018-10-26 10:19:22 UTC
GCC 6 branch is being closed
Comment 6 Dominique d'Humieres 2019-01-12 07:40:29 UTC
Related to/duplicate of pr34500.
Comment 7 kargls 2019-01-13 04:03:20 UTC
Author: kargl
Date: Sun Jan 13 04:02:46 2019
New Revision: 267902

URL: https://gcc.gnu.org/viewcvs?rev=267902&root=gcc&view=rev
Log:
2019-01-12  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/61765
	* resolve.c (gfc_verify_binding_labels): Break if-elseif-elseif
	structure into independent if's with a return to simplify logic.
	Avoid a check for ENTRY name with bind(c).

2019-01-12  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/61765
	* gfortran.dg/pr61765.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr61765.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
Comment 8 kargls 2019-01-13 04:04:32 UTC
Fixed on trunk.  Closing.
Comment 9 Dominique d'Humieres 2019-02-23 13:16:18 UTC
For the record, after revision r267902 the test in pr34500 comment 0 gives an ICE instead of a wrong error (see pr34500 comment 6).