public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46496] New: Missing strlen check / interop warnings with BIND(C) and non-C_* kinds
@ 2010-11-16  9:14 burnus at gcc dot gnu.org
  2014-03-22 19:40 ` [Bug fortran/46496] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-16  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Missing strlen check / interop warnings with BIND(C)
                    and non-C_* kinds
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


(a) is a wording nit  (by Richard Main)
(b) be able to turn off the warning  (common request by Richard Main et al.)
(c) to (e) are warning inconsistencies (examples by James Van Buskirk)
(f) is a missing constraint check (examples by James Van Buskirk)


gfortran warns if one does not use
  kind=<c>
where <c> is a constant defined in ISO_C_BINDING or a constant which has been
derived from it by direct assignment.

I think that's OK, however, many do not like it as one can see, e.g., at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/44d572766bce0e6f



a) The warning should use "dummy argument" and not the C-speak "parameter":

"Variable 'x' at (1) is a parameter to the BIND(C) procedure 'all_subs'
but may not be C interoperable" 


b) There should be some way to turn off this warning (and only this one) -
currently it is enabled by default and can only be turned of by "-w" which
silents all warnings.


c) One should consider allowing:
     KIND(variable/parameter with the bind-c-compatible kind)
   Currently, using such a kind parameter gives a warning, e.g. for

module mytypes
   use ISO_C_BINDING
   implicit none
   private
   public T
   type, bind(C) :: T
      character(len=1,kind=kind(C_CHAR_'A')) item ! kind=KIND(): Gives warning
   end type T
end module mytypes


d) The following should show a warning as one sets the LEN= and not the KIND=
parameter; the len=C_char is OK, but the kind=c_char is missing.

module mytypes
   use ISO_C_BINDING
   implicit none
   private
   public T
   type, bind(C) :: T
      character(C_CHAR) item  ! len=c_char: Warning is missing
   end type T
end module mytypes 


e) Ditto for:

module mytypes
   use ISO_C_BINDING
   implicit none
   private
   public T
   type, bind(C) :: T
      character*(C_CHAR), item
   end type T
end module mytypes 


f) The following two examples are invalid - but seemingly gfortran does not
check the string length of DT character components:

module mytypes
   use ISO_C_BINDING
   implicit none
   private
   public T
   type, bind(C) :: T
      character(len=2,kind=C_CHAR) item ! INVALID length: 2
   end type T
end module mytypes

module mytypes
   use ISO_C_BINDING
   implicit none
   private
   public T
   type, bind(C) :: T
      character(len=*,kind=C_CHAR) item*(2) ! INVALID length of 2
   end type T
end module mytypes


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

* [Bug fortran/46496] Missing strlen check / interop warnings with BIND(C) and non-C_* kinds
  2010-11-16  9:14 [Bug fortran/46496] New: Missing strlen check / interop warnings with BIND(C) and non-C_* kinds burnus at gcc dot gnu.org
@ 2014-03-22 19:40 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-22
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r208766.


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

end of thread, other threads:[~2014-03-22 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16  9:14 [Bug fortran/46496] New: Missing strlen check / interop warnings with BIND(C) and non-C_* kinds burnus at gcc dot gnu.org
2014-03-22 19:40 ` [Bug fortran/46496] " dominiq at lps dot ens.fr

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).