public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* non-contiguous target error
@ 2018-05-17 22:35 Cesar Philippidis
       [not found] ` <HE1PR09MB0505C9EA53881412CDC3155D85900@HE1PR09MB0505.eurprd09.prod.outlook.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Cesar Philippidis @ 2018-05-17 22:35 UTC (permalink / raw)
  To: Thomas Koenig, Fortran List

Hi,

I noticed that gfortran 8 now errors when contiguous pointers point to
non-explicitly contiguous targets. E.g.

 program test
   implicit none
   real,pointer :: p1(:)
   real,pointer,contiguous :: p2(:,:,:)

   allocate(p1(12))

   p2(1:2,1:2,1:2) => p1(4:)
 end program

This behavior seems to be too strict. Maybe it should be a warning?

Thanks,
Cesar

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: non-contiguous target error
       [not found] ` <HE1PR09MB0505C9EA53881412CDC3155D85900@HE1PR09MB0505.eurprd09.prod.outlook.com>
@ 2018-05-18 13:42   ` Cesar Philippidis
  0 siblings, 0 replies; 2+ messages in thread
From: Cesar Philippidis @ 2018-05-18 13:42 UTC (permalink / raw)
  To: Arjen Markus, Fortran List

On 05/18/2018 02:08 AM, Arjen Markus wrote:

>> I noticed that gfortran 8 now errors when contiguous pointers point
>> to non-explicitly contiguous targets. E.g.
>> 
>> program test implicit none real,pointer :: p1(:) 
>>  real,pointer,contiguous :: p2(:,:,:)
>> 
>>  allocate(p1(12))
>> 
>>  p2(1:2,1:2,1:2) => p1(4:) end program
>> 
>> This behavior seems to be too strict. Maybe it should be a
>> warning?
>> 
> 
> I do not have gfortran 8 available, so I cannot check my idea, but
> the array section p1(4:) is 9 elements long and the pointer p2 is 8
> elements. Could the error message come from that discrepancy?

Good point, but the program still fails when I allocate 20 elements for p1.

Cesar

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-18 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 22:35 non-contiguous target error Cesar Philippidis
     [not found] ` <HE1PR09MB0505C9EA53881412CDC3155D85900@HE1PR09MB0505.eurprd09.prod.outlook.com>
2018-05-18 13:42   ` Cesar Philippidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).