Bug 33310 - Bind(C): Accepts PARAMETER with BIND(C) attribute
Summary: Bind(C): Accepts PARAMETER with BIND(C) attribute
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 32630
  Show dependency treegraph
 
Reported: 2007-09-05 11:12 UTC by Tobias Burnus
Modified: 2007-09-12 10:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-09-05 11:12:17 UTC
I believe the following is invalid - combining PARAMETER with BIND(C), however, gfortran does not reject this; if one tries to use-associate the parameter in the main program, one gets an error.

module m
    use iso_c_binding
    implicit none
    TYPE, bind(C) :: the_distribution
        INTEGER(c_int) :: parameters(1)
    END TYPE the_distribution
    TYPE (the_distribution), parameter, bind(C) :: the_beta = the_distribution((/0/))
end module m
Comment 1 Tobias Burnus 2007-09-05 11:15:49 UTC
"The BIND statement specifies the BIND attribute (5.1.2.4) for a list of variables and common blocks."

and

"The BIND attribute for a variable or common block specifies that it is capable of interoperating with a C variable that has external linkage (15.3)."

I would argue that a symbol with a PARAMETER attribute is not a "variable" but a "named constant" and thus BIND(C) is invalid.
Comment 2 patchapp@dberlin.org 2007-09-12 09:20:22 UTC
Subject: Bug number PR33310

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00333.html
Comment 3 Tobias Burnus 2007-09-12 10:27:39 UTC
Subject: Bug 33310

Author: burnus
Date: Wed Sep 12 10:27:27 2007
New Revision: 128423

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128423
Log:
2007-09-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33284
	PR fortran/33310
	* symbol.c (check_conflict): Add conflict between INTRINSIC and ENTRY
	and between BIND(C) and PARAMETER.

2007-09-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33284
	PR fortran/33310
	* gfortran.dg/conflicts_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/conflicts_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Tobias Burnus 2007-09-12 10:35:37 UTC
FIXED.
Comment 5 Tobias Burnus 2007-09-12 10:36:17 UTC
Really mark as FIXED.