The following is a misleading error message. The return type may be a character string -- but only of length one! FUNCTION F_X(A) bind(c,name='F_X') 1 Error: Return type of BIND(C) function 'f_x' at (1) cannot be a character string Example (taken from: http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/ee444a5894644f72#) FUNCTION F_X(A) bind(c,name='F_X') CHARACTER*(*) F_X END FUNCTION NAG prints: Error: BIND(C) function F_X has assumed CHARACTER length though the error for "CHARACTER(len=4)" is also not that helpful: Error: BIND(C) function F_X has CHARACTER(LEN=4) Maybe one can keep the current string and only add "with length > 1", i.e. Error: Return type of BIND(C) function 'f_x' at (1) cannot be a character string with length > 1
Thinking of it again, one probably needs also NAGs error message as: FUNCTION F_X(A) bind(c,name='F_X') CHARACTER*(*) F_X END FUNCTION ... interface FUNCTION F_X(A) bind(c,name='F_X') CHARACTER*(1) F_X END FUNCTION end interface is also invalid - even though the effective string length is one; F2008 has: "If the type is character, the length type parameter is interoperable if and only if its value is one." [...] [only interoperable] "if it is of type character its length is not assumed or declared by an expression that is not a constant expression." Thus, one could think of handling the assumed length case explicitly. Or one uses, e.g. Error: Return type of BIND(C) function 'f_x' at (1) of character type must have length 1
Author: aoliva Date: Fri Nov 26 04:25:32 2010 New Revision: 167160 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167160 Log: PR other/46020 * configure.ac (CXX_FOR_TARGET): Add -funconfigured-libstdc++-v3. * Makefile.def (CXX_FOR_TARGET): Removed from flags_to_pass. * Makefile.tpl (CXX_FOR_TARGET_FLAG_TO_PASS): New. (BASE_FLAGS_TO_PASS): Use it. * configure: Rebuilt. * Makefile.in: Rebuilt. Modified: trunk/ChangeLog trunk/Makefile.def trunk/Makefile.in trunk/Makefile.tpl trunk/configure trunk/configure.ac
Author: aoliva Date: Fri Nov 26 04:29:41 2010 New Revision: 167163 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167163 Log: PR other/46020 * configure.ac (CXX_FOR_TARGET): Add -funconfigured-libstdc++-v3. * Makefile.def (CXX_FOR_TARGET): Removed from flags_to_pass. * Makefile.tpl (CXX_FOR_TARGET_FLAG_TO_PASS): New. (BASE_FLAGS_TO_PASS): Use it. * configure: Rebuilt. * Makefile.in: Rebuilt. Modified: branches/transactional-memory/ChangeLog branches/transactional-memory/Makefile.def branches/transactional-memory/Makefile.in branches/transactional-memory/Makefile.tpl branches/transactional-memory/configure branches/transactional-memory/configure.ac
Sorry about the spam, these check ins were meant for bug 46026.
Author: aoliva Date: Mon Dec 6 13:04:07 2010 New Revision: 167491 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167491 Log: Check in for PR other/46020 was meant for PR other/46026. Modified: branches/transactional-memory/ChangeLog
Author: aoliva Date: Mon Dec 6 13:11:51 2010 New Revision: 167493 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167493 Log: Check in for PR other/46020 was meant for PR other/46026. Modified: trunk/ChangeLog
Status: Unfixed. See comment 0 for the description.
Related to pr46496.
Author: tkoenig Date: Thu Nov 1 11:55:43 2018 New Revision: 265716 URL: https://gcc.gnu.org/viewcvs?rev=265716&root=gcc&view=rev Log: 2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46020 * gfortran.dg/bind_c_usage_7.f90: Adjust error message. * gfortran.dg/bind_c_usage_32.f90: New test. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/bind_c_usage_7.f03
Author: tkoenig Date: Thu Nov 1 11:56:26 2018 New Revision: 265717 URL: https://gcc.gnu.org/viewcvs?rev=265717&root=gcc&view=rev Log: 2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46020 * gfortran.dg/bind_c_usage_32.f90: Really commit. Added: trunk/gcc/testsuite/gfortran.dg/bind_c_usage_32.f90
Author: tkoenig Date: Thu Nov 1 12:00:59 2018 New Revision: 265719 URL: https://gcc.gnu.org/viewcvs?rev=265719&root=gcc&view=rev Log: 2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46020 * decl.c (verify_bind_c_sym): Improve error message. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c
I don't think there is anything left to fix. Closing.
Author: tkoenig Date: Thu Nov 1 18:41:28 2018 New Revision: 265727 URL: https://gcc.gnu.org/viewcvs?rev=265727&root=gcc&view=rev Log: 2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46020 * gfortran.dg/bind_c_18.f90: Adjust error message. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/bind_c_18.f90
Author: tkoenig Date: Fri Nov 2 20:20:43 2018 New Revision: 265757 URL: https://gcc.gnu.org/viewcvs?rev=265757&root=gcc&view=rev Log: 2018-11-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46020 * decl.c (verify_bind_c_sym): Remove unnecessary space in error message. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c