Bug 38829 - Bogus BIND(C) error message
Summary: Bogus BIND(C) error message
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks: ISO_C_Binding
  Show dependency treegraph
 
Reported: 2009-01-13 18:06 UTC by Tobias Burnus
Modified: 2014-06-08 15:29 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-29 08:42:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2009-01-13 18:06:29 UTC
Compiling the following program gives the error:

Error: Type 'y_c' at (1) is a parameter to the BIND(C)  procedure 'wrapper' but is not C interoperable because derived type 'ty_c' is not C interoperable

It works if one moves the TYPE declaration up. It also works with the SUBROUTINE is not BIND(C).

TODO:
- Move check from decl.c to resolve.c
- Change "parameter" to (dummy/formal) "argument" as otherwise it can be confused with the PARAMETER attribute.

Found at:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/5392e4c270d4f3c7
Where it was reported by Steven Correll.


MODULE mExample
CONTAINS
      SUBROUTINE wrapper(y_c) bind(c)
      USE iso_c_binding
      type, bind(c) :: ty_c
        type(c_ptr) :: y_cptr
        Integer(c_int) ny
      end type
      type(ty_c) :: y_c
      END SUBROUTINE
END MODULE
Comment 1 Francois-Xavier Coudert 2014-06-08 15:26:23 UTC
This was fixed in gfortran 4.6 and later.
Comment 2 Francois-Xavier Coudert 2014-06-08 15:29:31 UTC
Author: fxcoudert
Date: Sun Jun  8 15:28:59 2014
New Revision: 211354

URL: http://gcc.gnu.org/viewcvs?rev=211354&root=gcc&view=rev
Log:
	PR fortran/38829
	* gfortran.dg/bind_c_usage_29.f90: New file.

Added:
    trunk/gcc/testsuite/gfortran.dg/bind_c_usage_29.f90
Modified:
    trunk/gcc/testsuite/ChangeLog