OSDN Git Service

2009-08-20 Thomas Koenig <tkoenig@gcc.gnu.org>
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Aug 2009 20:16:15 +0000 (20:16 +0000)
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Aug 2009 20:16:15 +0000 (20:16 +0000)
PR libfortran/40962
* iso_c_binding.c (c_f_pointer_u0):  Multiply stride by
previous stride.

2009-08-20  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/40962
* c_f_pointer_tests_4.f90:  New test.

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

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/intrinsics/iso_c_binding.c

index c341ae8..b3d1357 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR libfortran/40962
+       * c_f_pointer_tests_4.f90:  New test.
+
 2009-08-20  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/slice6.adb: New test.
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90
new file mode 100644 (file)
index 0000000..4f5338d
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do run }
+program main
+   use iso_c_binding, only: c_ptr, c_loc, c_f_pointer
+   implicit none
+   integer, dimension(2,1,2), target :: table
+   table = reshape ( (/ 1,2,-1,-2/), (/2,1,2/))
+   call set_table (c_loc (table))
+contains
+   subroutine set_table (cptr)
+     type(c_ptr), intent(in) :: cptr
+     integer, dimension(:,:,:), pointer :: table_tmp
+     call c_f_pointer (cptr, table_tmp, (/2,1,2/))
+     if (any(table_tmp /= table)) call abort
+   end subroutine set_table
+end program main
index 7a0f056..b22306f 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR libfortran/40962
+       * iso_c_binding.c (c_f_pointer_u0):  Multiply stride by
+       previous stride.
+
 2009-08-20  Dave Korn  <dave.korn.cygwin@gmail.com>
 
        * Makefile.am (LTLDFLAGS): Add -bindir flag.
index 0dd7449..569b122 100644 (file)
@@ -152,7 +152,7 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in,
            }
          else
            {
-             str = GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1);
+             str = str * GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1);
              f_ptr_out->offset += str;
            }