]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2019-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 14 Apr 2019 20:15:48 +0000 (20:15 +0000)
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 14 Apr 2019 20:15:48 +0000 (20:15 +0000)
    PR fortran/85448
    * gfortran.dg/bind_c_usage_33.f90: New test and...
    * gfortran.dg/bind_c_usage_33_c.c: Additional source.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270354 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bind_c_usage_33.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/bind_c_usage_33_c.c [new file with mode: 0644]

index 4ede1de27cf5b9fce5e2c3de2d5e8bf6b8ee5c5d..0c4ae15ae9b6adb0a8e0d609a4babbb985782e48 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       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  <pault@gcc.gnu.org>
 
        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 (file)
index 0000000..62571e4
--- /dev/null
@@ -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 (file)
index 0000000..de09b51
--- /dev/null
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+void odopen(int*);
+
+int main()
+{
+  int unit = 42;
+  odopen(&unit);
+  if (unit != 8)
+    {
+      fprintf(stderr,"wrong result");
+      return 1;
+    }
+   return 0;
+}