- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A simple statement: print *,a(b(1:2)) compiles without a complaint,
Command: ifort -check all -debug all -fpe0 -traceback test.f90
but the execution fails, with the message:
Run-Time Check Failure. The variable 'var$21' is being used in 'test.f90(11,1)' without being defined
program test
implicit none
real(8) :: a(2),c(2)
integer :: b(2)
a(1:2)=(/10,20/); b(1:2)=(/1,2/)
print *,a(b(1:2))
end program test
There are other ways to do it: e.g. replacing the print statement by:
c(1:2)=a(b(1:2))
print *,c(1:2)
Prints without a complaint
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting the error. It is a known issue under fixing and the bug report ID is DPD200416730.
Thanks,
Xiaoping Duan
Intel Customer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Duan,
I would prefer having a compilation error and not a runtime error.
Even a compilation warning, explaining that this is a compiler bug, is much better than
getting this very unpleasant runtime error, which requires a long debugging before daring to call it a compiler bug.
Josef Stein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>Even a compilation warning, explaining that this is a compiler bug
I do not think it is possible for the compiler to warn you of bad code generation. If someone has the skill to add this capability, then they could also have the compiler automatically fix the bug.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page