- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I filed a bug report on the ICE, CMPLRLLVM-42645. I'll track and see when it's fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Fortran Developer Guide and Reference now properly shows the formulas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good News! This ICE is fixed in the upcoming release of ifx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler with the fix to this ICE is available now as part of oneAPI 2023.1.
Give it a try!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I now get a warning when specifying "-stand".
Great, thanks!
This makes us all winners!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page