[patch,wip] warn on noncontiguous pointers

Cesar Philippidis cesar@codesourcery.com
Wed Sep 26 18:51:00 GMT 2018


As of GCC 8, gfortran now errors when a pointer with a contiguous
attribute is set to point to a target without a contiguous attribute. I
think this is overly strict, and should probably be demoted to a
pedantic warning as I've done in the attached patch.

I ran into this issue while I was tuning GCC for lsdalton. Specifically,
CMake generates (not exactly because I reduced it) the following test
case for ScaTeLib to determine if that library can be enabled:

program test
   implicit none
   real,pointer :: fptr1(:)
   real,pointer,contiguous :: fptr3(:,:,:)

   allocate(fptr1(12))
   call random_number(fptr1)

   !Test pointer reshape II

   fptr3(1:2,1:2,1:2) => fptr1(4:)
end program

Note how fptr1 doesn't have a contiguous attribute. Does anyone have
thoughts on this? Maybe the ScaTeLib code needs to be updated.

Thanks,
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-Disable-Assignment-to-contiguous-pointer-fro.patch
Type: text/x-patch
Size: 1195 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180926/1e3f640b/attachment.bin>


More information about the Fortran mailing list