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.
29280 토론

Simplification of ISHFTC may cause ICE

Harald1
새로운 기여자 II
3,171 조회수

The following snippet of invalid code crashes current ifort:

program p
  integer, parameter :: a = ishftc(1, 10, 0) ! ICE
! print *, ishftc(1, 10, 0)                  ! No ICE
end

I get:

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.7.1 Build 20221019_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

 Intel(R) Fortran 2021.7.1-1776
ifort-ishftc.f90: catastrophic error: **Internal compiler error: floating point exception signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.

The SIZE argument is out of range; it must be positive.  But it shouldn't crash the compiler.

 

1 솔루션
Barbara_P_Intel
2,430 조회수

This second case is fixed now, too, in the compilers that were released this week. 

@Harald1,  it seems like you are a winner with this release, 2024.0!

원본 게시물의 솔루션 보기

0 포인트
14 응답
JohnNichols
소중한 기여자 III
3,136 조회수

JohnNichols_0-1670785498799.png

If I search for ishftc, the Intel Fortran documentation explains, IMHO, why your call is wrong, I agree it should throw an error not an ICE. 

If I then tap on the model of bit data represented on the page, I get the above page, but the pictures refer to pages that no longer exist. 

Perhaps we could fix both problems. 

 

0 포인트
Barbara_P_Intel
3,098 조회수

I filed a bug report on the ICE, CMPLRLLVM-42645. I'll track and see when it's fixed.


0 포인트
Barbara_P_Intel
3,094 조회수

About the documentation ... I filed another bug, DOC-10657. What's missing are some formulas. The formulas show up okay in the .pdf version of the DGR (Developer Guide and Reference). Here's the first one.

Barbara_P_Intel_0-1670969822888.png

 

 

0 포인트
Barbara_P_Intel
3,022 조회수

The Fortran Developer Guide and Reference now properly shows the formulas. 

0 포인트
Barbara_P_Intel
2,895 조회수

Good News! This ICE is fixed in the upcoming release of ifx.


0 포인트
Barbara_P_Intel
2,826 조회수

The compiler with the fix to this ICE is available now as part of oneAPI 2023.1.

Give it a try!

 

0 포인트
Harald1
새로운 기여자 II
2,798 조회수

Barbara,

I tried the new compiler.  The ICE is gone, but I believe the diagnostics could still be better, as it does not report that the SIZE argument shall be positive.

Consider the variation:

program p
  integer, parameter :: a = ishftc(1, 10, 0) ! invalid
  integer, parameter :: b = ishftc(1,  0, 0) ! invalid
end

This now compiles without warning, unless I add -stand:

% ifort ifort-ishftc.f90 -stand
ifort-ishftc.f90(2): warning #7317: Standard F2018 requires that the absolute value of SHIFT, the 2nd argument, be less than or equal to SIZE, the 3rd argument.   [ISHFTC]
  integer, parameter :: a = ishftc(1, 10, 0) ! invalid
----------------------------^

Note that it misses the second invalid declaration.  So the issue is only almost resolved....

Thanks,

Harald

 

0 포인트
jimdempseyatthecove
명예로운 기여자 III
2,795 조회수

I wonder why Fortran uses a derivative of "shift" for this as opposed to (just about) everyone else using a derivative of "rotate".

I suspect ishftc is an abbreviation of IntegerShiftCircular, imho rotate would have been a better choice.

Also, other implementations permit bit counts that exceed BIT_SIZE (as internally they perform a MOD on the bitsize for rotate.

Jim Dempsey

 

0 포인트
Steve_Lionel
명예로운 기여자 III
2,782 조회수

"Circular shift" is also a common term - I hear that more than rotate. ISHFT and ISHFTC date from MIL-STD-1753 in the late 1970s.

0 포인트
Barbara_P_Intel
2,717 조회수

I'm checking with the resident Fortran language experts on the warning message.

Last time I checked abs (0) <= 0 was true. The second usage should be fine, no warning.

 

0 포인트
Harald1
새로운 기여자 II
2,709 조회수

I'm sorry to bother you again, but regarding the second usage, let me quote from the F2018 draft standard:

16.9.104 ISHFTC (I, SHIFT [, SIZE])
...
Arguments.
...
SIZE (optional) shall be of type integer. The value of SIZE shall be positive and shall not exceed BIT_SIZE (I).
If SIZE is absent, it is as if it were present with the value of BIT_SIZE (I).

Note that "0" is not a positive number, so I disagree with your assessment, as does NAG:

NAG Fortran Compiler Release 7.1(Hanzomon) Build 7101
Warning: ifort-ishftc2.f90, line 2: Unused PARAMETER A
Error: ifort-ishftc2.f90, line 2: SIZE argument (0) to intrinsic ISHFTC out of range (1:32)
Warning: ifort-ishftc2.f90, line 3: Unused PARAMETER B
Error: ifort-ishftc2.f90, line 3: SIZE argument (0) to intrinsic ISHFTC out of range (1:32)
Errors in declarations, no further processing for P
[NAG Fortran Compiler error termination, 2 errors, 2 warnings]

 

Barbara_P_Intel
2,698 조회수

Thanks for the clarification. I got tangled up in what the warning message reported which is not really correct. I filed a bug report to clarify the message and identify the problem in the second case, CMPLRLLVM-46728.

 

 

0 포인트
Barbara_P_Intel
2,431 조회수

This second case is fixed now, too, in the compilers that were released this week. 

@Harald1,  it seems like you are a winner with this release, 2024.0!

0 포인트
Harald1
새로운 기여자 II
2,418 조회수

Yes, I now get a warning when specifying "-stand".

Great, thanks!

This makes us all winners!

 

0 포인트
응답