From 0859be177649f940d85209820906b0399626d839 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 12 Mar 2012 10:03:49 +0100 Subject: [PATCH] re PR fortran/52542 (Procedure with a Bind (C) named interface does not inherit the Bind (C)) 2012-03-12 Tobias Burnus PR fortran/52542 * decl.c (match_procedure_decl): If the interface is bind(C), the procedure is as well. 2012-03-12 Tobias Burnus PR fortran/52542 * gfortran.dg/proc_ptr_35.f90: New. From-SVN: r185215 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/decl.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/proc_ptr_35.f90 | 16 ++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_35.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2da6551b608..7a0ec871266 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-03-12 Tobias Burnus + + PR fortran/52542 + * decl.c (match_procedure_decl): If the interface + is bind(C), the procedure is as well. + 2012-03-10 Steven Bosscher * convert.c (convert): Fold BOOLEAN_TYPE types to the proper variant. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 75b8a899c5e..4da21c316e3 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4855,6 +4855,13 @@ match_procedure_decl (void) if (m == MATCH_ERROR) return MATCH_ERROR; + if (proc_if && proc_if->attr.is_bind_c && !current_attr.is_bind_c) + { + current_attr.is_bind_c = 1; + has_name_equals = 0; + curr_binding_label = NULL; + } + /* Get procedure symbols. */ for(num=1;;num++) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb5afed9926..cdca21e6555 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-03-12 Tobias Burnus + + PR fortran/52542 + * gfortran.dg/proc_ptr_35.f90: New. + 2012-03-11 Uros Bizjak PR target/52530 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_35.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_35.f90 new file mode 100644 index 00000000000..b6ca3a67b42 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_35.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR fortran/52542 +! +! Ensure that the procedure myproc is Bind(C). +! +! Contributed by Mat Cross of NAG +! +interface + subroutine s() bind(c) + end subroutine s +end interface +procedure(s) :: myproc +call myproc() +end +! { dg-final { scan-assembler-not "myproc_" } }