public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays Date: Wed, 11 Jul 2007 21:20:00 -0000 [thread overview] Message-ID: <bug-32732-13404@http.gcc.gnu.org/bugzilla/> (raw) | subroutine foo(a) bind(c) | character(len=1,kind=c_char), value :: a Has a single, scalar argument a; in C notation: | void foo(char a) gfortran, however, uses | void foo(char a[]) with length one. This causes problems on IA-64 HP-UX, see thread starting at http://gcc.gnu.org/ml/fortran/2007-07/msg00210.html (If "a" is a scalar, one needs to audit also all character uses to make sure that one does use it as such (and does not compile Fortran "if(a /= 5)" into C "if(*a != 5) as "a" is not a pointer.) Additionally, If the function is called, the length is additionally passed to the function: | call foo("a") produces: | foo("a", 1) // 'a' array, not zero terminated instead of | foo('a') As the length arguments come always last and are not used, this seems to be harmless, but there might be platforms or scenarios where they may cause problems. -- Summary: [Bind C] Character scalars are passed as arrays Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code 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=32732
next reply other threads:[~2007-07-11 21:20 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-07-11 21:20 burnus at gcc dot gnu dot org [this message] 2007-07-18 18:11 ` [Bug fortran/32732] " patchapp at dberlin dot org 2007-07-23 9:03 ` burnus at gcc dot gnu dot org 2007-07-23 9:08 ` burnus at gcc dot gnu dot org 2007-07-25 22:56 ` sje at cup dot hp dot com 2007-08-07 0:27 ` kargl at gcc dot gnu dot org 2007-08-07 0:29 ` kargl at gcc dot gnu dot org
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-32732-13404@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).