From 33215bb37f598adbbde2a90e301d37165072dcc2 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 29 Jul 2009 16:44:51 +0200 Subject: [PATCH] re PR fortran/40898 (STDCALL mangling problem for strings @8 instead of @4) 2009-07-29 Tobias Burnus PR fortran/40898 * trans-types.c (gfc_get_function_type): Do not add hidden string-length argument for BIND(C) procedures. * trans-decl.c (create_function_arglist): Skip over nonexisting string-length arguments for BIND(C) procedures. From-SVN: r150216 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-decl.c | 3 ++- gcc/fortran/trans-types.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 623c601c1738..f89a8af3e38c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2009-07-29 Tobias Burnus + + PR fortran/40898 + * trans-types.c (gfc_get_function_type): Do not add hidden + string-length argument for BIND(C) procedures. + * trans-decl.c (create_function_arglist): Skip over nonexisting + string-length arguments for BIND(C) procedures. + 2009-07-28 Jakub Jelinek PR fortran/40878 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 65a6ac5cca9b..783c8f8308e2 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1724,7 +1724,8 @@ create_function_arglist (gfc_symbol * sym) type = TREE_VALUE (typelist); - if (f->sym->ts.type == BT_CHARACTER) + if (f->sym->ts.type == BT_CHARACTER + && (!sym->attr.is_bind_c || sym->attr.entry_master)) { tree len_type = TREE_VALUE (hidden_typelist); tree length = NULL_TREE; diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 77b8b9c66069..7b8423602809 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2249,7 +2249,7 @@ gfc_get_function_type (gfc_symbol * sym) Contained procedures could pass by value as these are never used without an explicit interface, and cannot be passed as actual parameters for a dummy procedure. */ - if (arg->ts.type == BT_CHARACTER) + if (arg->ts.type == BT_CHARACTER && !sym->attr.is_bind_c) nstr++; typelist = gfc_chainon_list (typelist, type); } -- 2.47.2