Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 討論

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

Harald1
新貢獻者 II
4,655 檢視

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 積分
1 解決方案
Steve_Lionel
榮譽貢獻者 III
4,607 檢視

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.

在原始文章中檢視解決方案

25 回應
Barbara_P_Intel
900 檢視

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

I filed CMPLRLLVM-39206.


JohnNichols
傑出貢獻者 III
713 檢視
Lol ANU is not a college. It is ranked 12 in the world. It is full of true nerds. Sometimes a ringer slips in.
jimdempseyatthecove
榮譽貢獻者 III
698 檢視

>> It is ranked 12 in the world.

In rolling trolleys into a river?

Your students will have to buck up a bit.

 

Jim Dempsey

andrew_4619
榮譽貢獻者 III
673 檢視

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]" 

 

Barbara_P_Intel
465 檢視

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



回覆