From ceae614e1debf582340fe73ca350db93966b24bb Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 14 Apr 2019 20:15:48 +0000 Subject: [PATCH] re PR fortran/85448 (Report binding label clash with a global identifyer) 2019-04-14 Thomas Koenig PR fortran/85448 * gfortran.dg/bind_c_usage_33.f90: New test and... * gfortran.dg/bind_c_usage_33_c.c: Additional source. From-SVN: r270354 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 | 21 +++++++++++++++++++ gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c | 15 +++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 create mode 100644 gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4ede1de27cf..0c4ae15ae9b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-14 Thomas Koenig + + PR fortran/85448 + * gfortran.dg/bind_c_usage_33.f90: New test and... + * gfortran.dg/bind_c_usage_33_c.c: Additional source. + 2019-04-14 Paul Thomas PR fortran/89843 diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 new file mode 100644 index 00000000000..62571e4731e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 @@ -0,0 +1,21 @@ +! { dg-do run } +! { dg-additional-sources bind_c_usage_33_c.c } +module m1 + implicit none + contains + subroutine odopen(unit) + integer,intent(out) :: unit + unit=8 + end subroutine +end module + +module m2 + use iso_c_binding + use m1 + implicit none + contains + subroutine c_odopen(unit) bind(c,name="odopen") + integer(c_int),intent(out) :: unit + call odopen(unit) + end subroutine +end module diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c b/gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c new file mode 100644 index 00000000000..de09b514db3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c @@ -0,0 +1,15 @@ +#include + +void odopen(int*); + +int main() +{ + int unit = 42; + odopen(&unit); + if (unit != 8) + { + fprintf(stderr,"wrong result"); + return 1; + } + return 0; +} -- 2.30.2