public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46496] New: Missing strlen check / interop warnings with BIND(C) and non-C_* kinds Date: Tue, 16 Nov 2010 09:14:00 -0000 [thread overview] Message-ID: <bug-46496-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2010-11-16 8:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-11-16 9:14 burnus at gcc dot gnu.org [this message] 2014-03-22 19:40 ` [Bug fortran/46496] " dominiq at lps dot ens.fr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-46496-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).