public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33215]  New: Bind(C): Accepts multiple entites with same (empty) binding name
@ 2007-08-28  9:21 burnus at gcc dot gnu dot org
  2007-08-28 10:04 ` [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-28  9:21 UTC (permalink / raw)
  To: gcc-bugs

The following program should give an error message as NAG f95 does:

Error: a.f90, line 4: Only one entity allowed with BIND(C,NAME=...)

gfortran currently happily accepts this.

module m
  use iso_c_binding
  implicit none
  integer(c_int), bind(C, name="") :: a,b
end module m


-- 
           Summary: Bind(C): Accepts multiple entites with same (empty)
                    binding name
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32630
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid
  2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
@ 2007-08-28 10:04 ` burnus at gcc dot gnu dot org
  2007-08-28 14:30 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-28 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-08-28 10:04 -------
The bug is actually worse as valid Fortran 2003 programs are rejected.

The following program should print "5 -5". The two static global variables are
not the same as their binding name is not "a" but something like "__m_MOD_a"
and "__n_MOD_a".

Somehow the binding is treated wrongly and thus one gets the error:

Error: Binding label 'a' at (1) collides with global entity 'a' at (2)

With NAG f95 the desired "5 -5" is printed. The program below should behave
identically for BIND(C,name="") and without. (Using the variable from C is
difficult, but one could think of passing the variable as actual argument or -
with TARGET attribute - a pointer to that variable.)

module m
  use iso_c_binding
  implicit none
  integer(c_int), save, bind(C, name="") :: a = 5
!  integer(c_int), save :: a = 5
end module m

module n
  use iso_c_binding
  implicit none
  integer(c_int), save, bind(C,name="") :: a = -5
!  integer(c_int), save :: a = -5
end module n

program prog
use m
use n, b=>a
implicit none
  print *, a, b
end program prog


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|Bind(C): Accepts multiple   |Bind(C): Bugs with empty
                   |entites with same (empty)   |"name=": Creates wrong
                   |binding name                |result and accepts invalid


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid
  2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
  2007-08-28 10:04 ` [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid burnus at gcc dot gnu dot org
@ 2007-08-28 14:30 ` fxcoudert at gcc dot gnu dot org
  2007-08-29  0:15 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-28 14:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-28 14:30:09
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid
  2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
  2007-08-28 10:04 ` [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid burnus at gcc dot gnu dot org
  2007-08-28 14:30 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-29  0:15 ` patchapp at dberlin dot org
  2007-08-29 13:09 ` burnus at gcc dot gnu dot org
  2007-08-29 13:36 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-08-29  0:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-08-29 00:14 -------
Subject: Bug number PR 33215

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-08/msg02019.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid
  2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-08-29  0:15 ` patchapp at dberlin dot org
@ 2007-08-29 13:09 ` burnus at gcc dot gnu dot org
  2007-08-29 13:36 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-29 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-08-29 13:09 -------
Subject: Bug 33215

Author: burnus
Date: Wed Aug 29 13:08:55 2007
New Revision: 127898

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127898
Log:
2007-08-29  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/33215
        * decl.c (build_sym): Pass number of identifiers on line to
        set_binding_label.
        (set_binding_label): Verify that only one identifier given if
        NAME= specified, even if the given binding label has zero length.
        (gfc_match_bind_c): Remove declaration for has_name_equals because
        it hides the static global one that is needed.

2007-08-29  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/33215
        * gfortran.dg/binding_label_tests_15.f03: New test case.
        * gfortran.dg/binding_label_tests_16.f03: Ditto.


Added:
    trunk/gcc/testsuite/gfortran.dg/binding_label_tests_15.f03
    trunk/gcc/testsuite/gfortran.dg/binding_label_tests_16.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid
  2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-08-29 13:09 ` burnus at gcc dot gnu dot org
@ 2007-08-29 13:36 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-29 13:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-08-29 13:36 -------
FIXED.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-08-29 13:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-28  9:21 [Bug fortran/33215] New: Bind(C): Accepts multiple entites with same (empty) binding name burnus at gcc dot gnu dot org
2007-08-28 10:04 ` [Bug fortran/33215] Bind(C): Bugs with empty "name=": Creates wrong result and accepts invalid burnus at gcc dot gnu dot org
2007-08-28 14:30 ` fxcoudert at gcc dot gnu dot org
2007-08-29  0:15 ` patchapp at dberlin dot org
2007-08-29 13:09 ` burnus at gcc dot gnu dot org
2007-08-29 13:36 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).