Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Compiler Bug: contiguous attribute

Rodrigo_R_
Beginner
230 Views

Hi.

While working with the contiguous attribute, I got into this:

integer, allocatable, target :: a(:) 
integer, pointer, contiguous :: b(:) 
allocate(a(5)) 
a = 0 
b => a ! No problem here 
b => a(1:3) ! No problem here 
b => a(:3) ! Error 
associate(x => a(:3)) 
    b => x ! No problem here either 
end associate 

Ifort's error says I'm associating a contiguous pointer to a non contiguous target in the third case. I think in all the cases the target is simply contiguous. Therefore, its a bug to throw an error only in the third case. Am I in the correct?

(I am using Intel Compiler 18 update 2 for windows, environment initialized for x64.)

0 Kudos
10 Replies
Rodrigo_R_
Beginner
230 Views

Any update on this?

Steve_Lionel
Black Belt Retired Employee
230 Views

I suggest that you report this at https://supporttickets.intel.com/?lang=en-US Issues reported here may get overlooked by Intel support.

Rodrigo_R_
Beginner
230 Views

I just reported as you suggested. Thank you for the attention.

Christoph_F_
Beginner
230 Views

Dear all,

has this issue already been addressed by the developers? (Sorry, I do not know how to check the status of the ticket.)

I am having a very similar problem in two cases with the false error message
"A pointer with the contiguous attributes is being made to a non-contiguous target"
after compilation with "-check all" with two compiler versions (18.0.2 20180210 and 19.0.0.117 20180804).

In the first case the target is an automatic array on the stack:

complex(real64), target :: hmtpw(2,(maxlcut+1)**2,maxval(neq))
complex(real64), pointer :: hmtpw_p(:,:)
hmtpw_p => hmtpw(:,:lm2)

The parameters "maxlcut" and "neq(:)" are taken from a module. The variable lm2 is calculated at runtime.

In the other case the target is another pointer included from a module with the CONTIGUOUS attribute:

complex(real64), pointer, contiguous :: cpw(:,:,:,:)  ! in the module (it is allocated as shared MPI3 memory)

complex(real64), pointer, contiguous :: vec(:) ! in the respective subroutine
vec => cpw(:n1,n2,n3,n4)
 

I think in both cases the target is contiguous, and Ifort should not complain.

Thank you.

Best regards
Christoph

FortranFan
Honored Contributor II
230 Views

Christoph F. wrote:

.. has this issue already been addressed by the developers? (Sorry, I do not know how to check the status of the ticket.) ..

I think in both cases the target is contiguous, and Ifort should not complain. ..

@Christoph,

Is it possible for you to try out the recently released Update 3 of Intel Fortran 19.0 compiler version and check for yourself?  Per this thread, it appears Intel Fortran team has included fixes on some related matters at least:

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/746360#n...

For any unresolved issues, your best option will be to submit support requests at Intel Online Support Center (OSC) using your own reproducer cases: https://supporttickets.intel.com/?lang=en-US

Christoph_F_
Beginner
230 Views

Hello FortranFan,

thank you very much for your quick reply.

Unfortunately, the latest version we have is 19.0.0.117 20180804. As soon as I can get my hands on Update 3, I will check it.

My question would be: Am I correct in assuming that in both described cases (target in stack memory and target as contiguous pointer array in a module) the target is, in fact, contiguous, and the compiler is wrong in giving this error message? Just to make sure that the code is correct.

With best regards
Christoph

jimdempseyatthecove
Black Belt
230 Views
!  contiguous.f90 
program contiguous
    implicit none
    integer, allocatable, target :: a(:) 
    integer, pointer, contiguous :: b(:) 
    allocate(a(5)) 
    a = 0 
    b => a ! No problem here 
    b => a(1:3) ! No problem here 
    b => a(:3) ! Error 
    associate(x => a(:3)) 
        b => x ! No problem here either 
    end associate 
    print *, b
end program contiguous

Win32 Debug
1>------ Build started: Project: contiguous, Configuration: Debug Win32 ------
1>Compiling with Intel(R) Visual Fortran Compiler 19.0.1.144 [IA-32]...
1>contiguous.f90
1>Linking...
1>Embedding manifest...
1>
1>Build log written to  "file://c:\test\contiguous\contiguous\Debug\BuildLog.htm"
1>contiguous - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

x64 Debug
1>------ Build started: Project: contiguous, Configuration: Debug x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler 19.0.1.144 [Intel(R) 64]...
1>contiguous.f90
1>Linking...
1>Embedding manifest...
1>
1>Build log written to  "file://c:\test\contiguous\contiguous\x64\Debug\BuildLog.htm"
1>contiguous - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

x64 Release
1>------ Build started: Project: contiguous, Configuration: Release x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler 19.0.1.144 [Intel(R) 64]...
1>contiguous.f90
1>Linking...
1>Embedding manifest...
1>
1>Build log written to  "file://c:\test\contiguous\contiguous\x64\Release\BuildLog.htm"
1>contiguous - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

x64 Release and Run

           0           0           0
Press any key to continue . . .

Jim Dempsey

Christoph_F_
Beginner
230 Views
      subroutine sub(m,n)
      implicit none
      integer, intent(in)          :: m,n
      real,    target              :: array(2,m**2,n)
      real,    pointer, contiguous :: point(:,:)
      nullify(point)
      point => array (:,:,1)
      end

ifort -check all  -c -o sub.o sub.f

sub.f(7): error #5558: A pointer with the CONTIGUOUS attributes is being made to a non-contiguous target
      point => array (:,:,1)
------^
compilation aborted for sub.f (code 1)

ifort --version

ifort (IFORT) 19.0.3.199 20190206
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

 

FortranFan
Honored Contributor II
230 Views

Christoph F. wrote:
 

.. sub.f(7): error #5558: A pointer with the CONTIGUOUS attributes is being made to a non-contiguous target
      point => array (:,:,1)
------^
compilation aborted for sub.f (code 1)

ifort --version

ifort (IFORT) 19.0.3.199 20190206 ..

@Christoph F.,

At first glance, the code looks conforming; the target is "simply contiguous" if I'm not mistaken.  But I suggest you try to get Intel Fortran team to look at this by submitting a support request with this reproducer: https://supporttickets.intel.com/?lang=en-US

Christoph_F_
Beginner
230 Views

Hi FortranFan,

thank you, I just submitted a support ticket.

Slightly changing the code (only two array dimensions or using m instead of m**2 as upper boundary) make the error go away. So, it is most certainly a compiler error.

Best
Christoph

 

Reply