------- Comment #4 from tkoenig at gcc dot gnu dot org 2009-05-19 17:17 ------- Created an attachment (id=17894) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17894&action=view) Driver for failing test case (identical to c_f_pointer_shape_tests_2_driver.c)
$ gfortran c_f_pointer_shape_tests_4_driver.c c_f_pointer_shape_tests_4.f03 $ ./a.out Aborted $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../../../gcc/branches/fortran-dev/configure --prefix=/home/ig25 --enable-languages=c,fortran --enable-maintainer-mode Thread model: posix gcc version 4.5.0 20090506 (experimental) (GCC) The reason this fails is fairly obvious if you look at the code: In c_f_pointer_u0, there's for (i = 0; i < shapeSize; i++) { /* Lower bound is 1, as specified by the draft. */ f_ptr_out->dim[i].lbound = 1; /* Have to allow for the SHAPE array to be any valid kind for an INTEGER type. */ #ifdef HAVE_GFC_INTEGER_1 if (GFC_DESCRIPTOR_SIZE (shape) == 1) f_ptr_out->dim[i].ubound = ((GFC_INTEGER_1 *) (shape->data))[i]; which ignores the (sad) fact that shape could have a stride not equal to one. I found this when trying to convert this part to the array access macros. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40187