[Bug libfortran/40187] New: c_f_pointer with stride in SHAPE
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon May 18 17:58:00 GMT 2009
Using a SHAPE with stride doesn't work with c_f_pointer doesn't work
(modified test case from the testsuite):
$ diff -u c_f_pointer_shape_tests_4.f03
~/gcc/trunk/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03
--- c_f_pointer_shape_tests_4.f03 2009-05-18 19:55:36.000000000 +0200
+++
/home/ig25/gcc/trunk/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03
2007-11-17 17:27:32.000000000 +0100
@@ -29,13 +29,12 @@
integer(c_int), value :: num_rows
integer(c_int), value :: num_cols
integer, dimension(:,:), pointer :: myArrayPtr
- integer(c_long_long), dimension(3) :: shape
+ integer(c_long_long), dimension(2) :: shape
integer :: i,j
shape(1) = num_rows
- shape(2) = -3;
- shape(3) = num_cols
- call c_f_pointer(cPtr, myArrayPtr, shape(1:3:2))
+ shape(2) = num_cols
+ call c_f_pointer(cPtr, myArrayPtr, shape)
do j = 1, num_cols
do i = 1, num_rows
if(myArrayPtr(i,j) /= ((j-1)*num_rows)+(i-1)) call abort ()
$ gfortran
~/gcc/trunk/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c
c_f_pointer_shape_tests_4.f03
$ ./a.out
Aborted
--
Summary: c_f_pointer with stride in SHAPE
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40187
More information about the Gcc-bugs
mailing list