aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-03-13 07:21:33 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-03-13 07:21:33 +0000
commit55b9c612573a120ea39f0a80a51b3b1757248f12 (patch)
treebc8357be046f69da95493b65f945f8d0532dbdd4 /gcc/fortran/trans-decl.c
parent599b9f723e42b0efdf580c45bc03e12dec377edd (diff)
downloadgcc-55b9c612573a120ea39f0a80a51b3b1757248f12.zip
gcc-55b9c612573a120ea39f0a80a51b3b1757248f12.tar.gz
gcc-55b9c612573a120ea39f0a80a51b3b1757248f12.tar.bz2
[multiple changes]
2019-03-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/66695 PR fortran/77746 PR fortran/79485 * gfortran.h (gfc_symbol): Add bind_c component. (gfc_get_gsymbol): Add argument bind_c. * decl.c (add_global_entry): Add bind_c argument to gfc_get_symbol. * parse.c (parse_block_data): Likewise. (parse_module): Likewise. (add_global_procedure): Likewise. (add_global_program): Likewise. * resolve.c (resolve_common_blocks): Likewise. (resolve_global_procedure): Likewise. (gfc_verify_binding_labels): Likewise. * symbol.c (gfc_get_gsymbol): Add argument bind_c. Set bind_c in gsym. * trans-decl.c (gfc_get_module_backend_decl): Add bind_c argument to gfc_get_symbol. (gfc_get_extern_function_decl): If the sym has a binding label and it cannot be found in the global symbol tabel, it is the wrong one and vice versa. 2019-03-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/66695 PR fortran/77746 PR fortran/79485 * gfortran.dg/binding_label_tests_30.f90: New test. * gfortran.dg/binding_label_tests_31.f90: New test. * gfortran.dg/binding_label_tests_32.f90: New test. * gfortran.dg/binding_label_tests_33.f90: New test. From-SVN: r269635
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 36b7fdd..ada6370 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -843,7 +843,7 @@ gfc_get_module_backend_decl (gfc_symbol *sym)
{
if (!gsym)
{
- gsym = gfc_get_gsymbol (sym->module);
+ gsym = gfc_get_gsymbol (sym->module, false);
gsym->type = GSYM_MODULE;
gsym->ns = gfc_get_namespace (NULL, 0);
}
@@ -2002,9 +2002,22 @@ gfc_get_extern_function_decl (gfc_symbol * sym, gfc_actual_arglist *actual_args)
return get_proc_pointer_decl (sym);
/* See if this is an external procedure from the same file. If so,
- return the backend_decl. */
- gsym = gfc_find_gsymbol (gfc_gsym_root, sym->binding_label
- ? sym->binding_label : sym->name);
+ return the backend_decl. If we are looking at a BIND(C)
+ procedure and the symbol is not BIND(C), or vice versa, we
+ haven't found the right procedure. */
+
+ if (sym->binding_label)
+ {
+ gsym = gfc_find_gsymbol (gfc_gsym_root, sym->binding_label);
+ if (gsym && !gsym->bind_c)
+ gsym = NULL;
+ }
+ else
+ {
+ gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name);
+ if (gsym && gsym->bind_c)
+ gsym = NULL;
+ }
if (gsym && !gsym->defined)
gsym = NULL;