Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28463 Discussions

Intel rejects ASSOCIATED (pointer, target) for non-equal ranks

Harald1
New Contributor II
2,293 Views

The following code is rejected by ifort/ifx although it is valid F2008+:

subroutine s (ptr1, ptr2)
  real, pointer :: ptr1(:), ptr2(:,:)
  print *, associated (ptr1,ptr2)
  print *, associated (ptr2,ptr1)
end

I get:

ifort_associated_target.f90(3): error #6376: The shapes of the arguments do not conform.   [ASSOCIATED]
  print *, associated (ptr1,ptr2)
----------------------------^
ifort_associated_target.f90(4): error #6376: The shapes of the arguments do not conform.   [ASSOCIATED]
  print *, associated (ptr2,ptr1)
----------------------------^
compilation aborted for ifort_associated_target.f90 (code 1)

See e.g. F2018:16.9.16 for details on the expected result.

 

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
2,245 Views

Sorry. I disagree, and so does NAG Fortran:

D:\Projects>nagfor -c t.f90
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7108
Evaluation trial version of NAG Fortran Compiler Release 7.1(Hanzomon) Build 7108
Error: t.f90, line 3: Arguments to intrinsic ASSOCIATED have different type/kind/rank/char-length
Error: t.f90, line 4: Arguments to intrinsic ASSOCIATED have different type/kind/rank/char-length

What you're missing is this:

TARGET (optional) shall be allowable as the data-target or proc-target in a pointer assignment statement (10.2.2) in which POINTER is data-pointer-object or proc-pointer-object.

We then go to 10.2.2 which says (emphasis mine):

C1019 (R1033) If bounds-remapping-list is not specified, the ranks of data-pointer-object and data-target shall be the same.

So... not valid Fortran 2018.

View solution in original post

25 Replies
Barbara_P_Intel
Moderator
480 Views

I thought I saw an ICE reported in amongst these college pranks!

I filed CMPLRLLVM-39206.


0 Kudos
JohnNichols
Valued Contributor III
293 Views
Lol ANU is not a college. It is ranked 12 in the world. It is full of true nerds. Sometimes a ringer slips in.
0 Kudos
jimdempseyatthecove
Honored Contributor III
278 Views

>> It is ranked 12 in the world.

In rolling trolleys into a river?

Your students will have to buck up a bit.

 

Jim Dempsey

0 Kudos
andrew_4619
Honored Contributor II
253 Views

Thanks for quizzing and "testing"  the Fortran standard, this ultimately makes the language stronger

As to the  side discussion "Lol ANU is not a college", I think maybe this is down to perceived meaning of college. Is ANU Australian National University? If so that would fall into my (and several dictionaries) definition of a college including the ANU wiki entry which says "Its main campus encompasses seven teaching and research colleges....". Anyway I learned something. Additionally pretty much every higher education establishment on the planet claims some ranking in some list or other to be in the Top N for something generally where N < 20.  

 

To quote wiki again "ANU is regarded as one of the world's leading universities, and is ranked as the number one university in Australia and the Southern Hemisphere by the 2022 QS World University Rankings[6] and second in Australia in the Times Higher Education rankings.[7] Compared to other universities in the world, it is ranked 27th by the 2022 QS World University Rankings,[6] and equal 54th by the 2022 Times Higher Education.[7]" 

 

0 Kudos
Barbara_P_Intel
Moderator
45 Views

The ICE that was reported in this thread is fixed in the 2024.2 release. That's planned to be available in mid-2024.



0 Kudos
Reply