public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays @ 2007-07-11 21:20 burnus at gcc dot gnu dot org 2007-07-18 18:11 ` [Bug fortran/32732] " patchapp at dberlin dot org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: burnus at gcc dot gnu dot org @ 2007-07-11 21:20 UTC (permalink / raw) To: gcc-bugs | 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org @ 2007-07-18 18:11 ` patchapp at dberlin dot org 2007-07-23 9:03 ` burnus at gcc dot gnu dot org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: patchapp at dberlin dot org @ 2007-07-18 18:11 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from patchapp at dberlin dot org 2007-07-18 18:10 ------- Subject: Bug number PR 32732 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-07/msg01542.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org 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 ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: burnus at gcc dot gnu dot org @ 2007-07-23 9:03 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from burnus at gcc dot gnu dot org 2007-07-23 09:03 ------- Subject: Bug 32732 Author: burnus Date: Mon Jul 23 09:03:30 2007 New Revision: 126836 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126836 Log: 2007-07-23 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32732 * trans-decl.c (generate_local_decl): Convert the TREE_TYPE for by value character dummy args of BIND(C) procedures. * trans-expr.c (gfc_conv_variable): Do not build address expression for BT_CHARACTER dummy args. 2007-07-23 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32732 * gfortran.dg/c_char_tests.f03: New test case. * gfortran.dg/c_char_driver.c: Driver for c_char_tests.f03. * gfortran.dg/c_char_tests_2.f03: New test case. * gfortran.dg/value_6.f03: Ditto. * gfortran.dg/value_7.f03: Ditto. Added: trunk/gcc/testsuite/gfortran.dg/c_char_driver.c trunk/gcc/testsuite/gfortran.dg/c_char_tests.f03 trunk/gcc/testsuite/gfortran.dg/c_char_tests_2.f03 trunk/gcc/testsuite/gfortran.dg/value_6.f03 trunk/gcc/testsuite/gfortran.dg/value_7.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org 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 ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: burnus at gcc dot gnu dot org @ 2007-07-23 9:08 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from burnus at gcc dot gnu dot org 2007-07-23 09:08 ------- FIXED. Steve, please check under IA64 HP-UX whether it works now. -- 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=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org ` (2 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: sje at cup dot hp dot com @ 2007-07-25 22:56 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from sje at cup dot hp dot com 2007-07-25 22:56 ------- The test case is still not working for me on IA64 HP-UX. I also still see gfortran.dg/c_kind_params.f90 failing at all optimization levels. c_char_tests.f03 also fails -- sje at cup dot hp dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|FIXED | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org ` (3 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-08-07 0:27 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from kargl at gcc dot gnu dot org 2007-08-07 00:27 ------- Subject: Bug 32732 Author: kargl Date: Tue Aug 7 00:27:25 2007 New Revision: 127265 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127265 Log: 2007-08-06 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32732 * trans-expr.c (gfc_conv_scalar_char_value): Convert the tree and actual arg expressions for scalar characters passed by-value to bind(c) routines. (gfc_conv_function_call): Call gfc_conv_scalar_char_value. * trans.h: Add prototype for gfc_conv_scalar_char_value. * trans-decl.c (generate_local_decl): Convert by-value character dummy args of bind(c) procedures using gfc_conv_scalar_char_value. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans.h -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/32732] [Bind C] Character scalars are passed as arrays 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org ` (4 preceding siblings ...) 2007-08-07 0:27 ` kargl at gcc dot gnu dot org @ 2007-08-07 0:29 ` kargl at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-08-07 0:29 UTC (permalink / raw) To: gcc-bugs ------- Comment #6 from kargl at gcc dot gnu dot org 2007-08-07 00:29 ------- Hopefully, Chris' patch fixed this bug. If problems re-appear we can also re-open the PR. -- kargl at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32732 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-07 0:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-07-11 21:20 [Bug fortran/32732] New: [Bind C] Character scalars are passed as arrays burnus at gcc dot gnu dot org 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
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).