* [Bug fortran/34133] Bind(c): Accepts PROGRAM internal bind(c) procedure
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
@ 2007-11-17 18:19 ` burnus at gcc dot gnu dot org
2007-11-17 18:21 ` burnus at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-17 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-11-17 18:19 -------
Subject: Bug 34133
Author: burnus
Date: Sat Nov 17 18:19:16 2007
New Revision: 130260
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130260
Log:
2007-11-17 Tobias Burnus <burnus@net-b.de>
PR fortran/34133
* decl.c (gfc_match_suffix,gfc_match_subroutine): Disallow
bind(c) attribute for internal procedures.
2007-11-17 Tobias Burnus <burnus@net-b.de>
PR fortran/34133
* gfortran.dg/bind_c_usage_9.f03: New.
* gfortran.dg/interface_abstract_1.f90: Fix testcase.
Added:
trunk/gcc/testsuite/gfortran.dg/bind_c_usage_9.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/interface_abstract_1.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c): Accepts PROGRAM internal bind(c) procedure
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
2007-11-17 18:19 ` [Bug fortran/34133] " burnus at gcc dot gnu dot org
@ 2007-11-17 18:21 ` burnus at gcc dot gnu dot org
2007-11-19 18:13 ` crickett at lanl dot gov
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-17 18:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2007-11-17 18:21 -------
FIXED on the trunk (4.3.0). (Not part of any branch.)
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c): Accepts PROGRAM internal bind(c) procedure
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
2007-11-17 18:19 ` [Bug fortran/34133] " burnus at gcc dot gnu dot org
2007-11-17 18:21 ` burnus at gcc dot gnu dot org
@ 2007-11-19 18:13 ` crickett at lanl dot gov
2007-11-19 21:18 ` [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs burnus at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crickett at lanl dot gov @ 2007-11-19 18:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from crickett at lanl dot gov 2007-11-19 18:13 -------
(In reply to comment #2)
> FIXED on the trunk (4.3.0). (Not part of any branch.)
>
i don't think this constraint exists in F08 (at least i cannot find it).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-11-19 18:13 ` crickett at lanl dot gov
@ 2007-11-19 21:18 ` burnus at gcc dot gnu dot org
2007-11-19 21:27 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-19 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2007-11-19 21:17 -------
(In reply to comment #3)
> i don't think this constraint exists in F08 (at least i cannot find it).
You are right. However, there is still a constrain. Fortran 2003 has:
C1236 (R1225) A proc-language-binding-spec with a NAME= specifier shall not be
specified in the function-stmt or subroutine-stmt of an interface body for an
abstract interface or a dummy procedure.
C1237 (R1225) A proc-language-binding-spec shall not be specified for an
internal procedure.
while http://j3-fortran.org/doc/year/07/07-007r3.pdf has:
12.6.2.2 Function subprogram
C1252 (R1229) A proc-language-binding-spec with a NAME= specifier shall not be
specified in the function-stmt or subroutine-stmt of an internal procedure, or
of an interface body for an abstract interface or a dummy procedure.
Thus BIND(C) is allowed for internal procedures, but not BIND(C,name=...).
I think the idea is to allow such procedures, e.g., as actual argument; one
thing one needs to check is the following: How does this work in terms of name
mangling? Assume the following:
subroutine foo()
contains
subroutine bar() bind(c)
end subroutine bar
end subroutine foo
subroutine my() bind(c,name="bar")
end subroutine bar
This will cause name clashes of "bar". Internal procedures have the advantage
that they are internal and have no name clashes problems. I wonder what symbol
should be created for the internal procedure with bind(C) symbol. Maybe this is
something to check in the standard and ask at the j3 mailing list.
The following is invalid per Fortran 2003 and 2008 and accepted by gfortran:
subroutine bb(a)
interface
subroutine a() bind(c, name="foo") ! name= for dummy variable
end subroutine a
end interface
end subroutine bb
For the latter, we need a patch which rejects this outright. For the former, I
think a patch makes sense which allows it (w/o name=) for -std=gnu (and add a
note to PR 33197 to change the GFC_STD_GNU to GFC_STD_F2008 as soon as gfortran
has it.)
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
Summary|Bind(c): Accepts PROGRAM |Bind(c,name="") should be
|internal bind(c) procedure |rejected for dummies; F2008:
| |allow bind(c) for internal
| |procs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-11-19 21:18 ` [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs burnus at gcc dot gnu dot org
@ 2007-11-19 21:27 ` burnus at gcc dot gnu dot org
2007-11-20 5:04 ` patchapp at dberlin dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-19 21:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2007-11-19 21:27 -------
Ok. Found it in "15.5.2 Binding labels for procedures" of the Fortran 2008
draft with the expected wording:
"If a procedure has the BIND attribute with no NAME= specifier, and the
procedure is not a dummy procedure, internal procedure, or procedure pointer,
then the binding label of the procedure is the same as the name of the
procedure using lower case letters. Otherwise, the procedure has no binding
label."
Thus it can be handled the same way as gfortran does for 'bind(c,name="")':
Simply use the Fortran name (which encodes the module name and parent procedure
name).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-11-19 21:27 ` burnus at gcc dot gnu dot org
@ 2007-11-20 5:04 ` patchapp at dberlin dot org
2007-11-20 10:55 ` burnus at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-20 5:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from patchapp at dberlin dot org 2007-11-20 05:04 -------
Subject: Bug number PR34133
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-11/msg00956.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-11-20 5:04 ` patchapp at dberlin dot org
@ 2007-11-20 10:55 ` burnus at gcc dot gnu dot org
2007-11-20 14:01 ` patchapp at dberlin dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-20 10:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from burnus at gcc dot gnu dot org 2007-11-20 10:55 -------
Assign bug to myself. I have a patch, which does:
- rejects bind(c) with -std=f2003 for internal function (was missing!)
- Allows for -std=gnu bind(c) for internal procedures, but
rejects bind(c,name=...)
- Rejects binding names for dummy procedures
Now I only need to create a bunch of test cases.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |burnus at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-11-20 10:55:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-11-20 10:55 ` burnus at gcc dot gnu dot org
@ 2007-11-20 14:01 ` patchapp at dberlin dot org
2007-11-30 12:17 ` burnus at gcc dot gnu dot org
2007-11-30 16:05 ` burnus at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-20 14:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from patchapp at dberlin dot org 2007-11-20 14:01 -------
Subject: Bug number PR34133
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-11/msg01062.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-11-20 14:01 ` patchapp at dberlin dot org
@ 2007-11-30 12:17 ` burnus at gcc dot gnu dot org
2007-11-30 16:05 ` burnus at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-30 12:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from burnus at gcc dot gnu dot org 2007-11-30 12:16 -------
Subject: Bug 34133
Author: burnus
Date: Fri Nov 30 12:16:35 2007
New Revision: 130535
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130535
Log:
2007-11-20 Tobias Burnus <burnus@net-b.de>
PR fortran/34133
* match.h: Add bool allow_binding_name to gfc_match_bind_c.
* decl.c
* (match_attr_spec,gfc_match_bind_c_stmt,gfc_match_entry):
Adjust accordingly.
(gfc_match_bind_c): Add allow_binding_name argument, reject
binding name for dummy arguments.
(gfc_match_suffix,gfc_match_subroutine): Make use of
allow_binding_name.
2007-11-20 Tobias Burnus <burnus@net-b.de>
PR fortran/34133
* gfortran.dg/bind_c_usage_9.f03: Fixes; add -std=f2003.
* gfortran.dg/bind_c_usage_11.f03: New.
* gfortran.dg/bind_c_usage_12.f03: New.
Added:
trunk/gcc/testsuite/gfortran.dg/bind_c_usage_11.f03
trunk/gcc/testsuite/gfortran.dg/bind_c_usage_12.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/match.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/bind_c_usage_9.f03
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/34133] Bind(c,name="") should be rejected for dummies; F2008: allow bind(c) for internal procs
2007-11-17 12:57 [Bug fortran/34133] New: Bind(c): Accepts PROGRAM internal bind(c) procedure burnus at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-11-30 12:17 ` burnus at gcc dot gnu dot org
@ 2007-11-30 16:05 ` burnus at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-30 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from burnus at gcc dot gnu dot org 2007-11-30 16:04 -------
FIXED on the trunk (4.3.0).
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34133
^ permalink raw reply [flat|nested] 11+ messages in thread