- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following code ICEs with current ifort/ifx:
block data
implicit none
integer :: b(2,1)
data b( 1 ,1) / 11 / ! OK
data b([2],1) / 21 / ! ICE
common /com/ b
end block data
program test
integer :: b(2,1)
common /com/ b
print *, b
end program test
I get:
% ifort ifort-data-vector-section.f90
ifort-data-vector-section.f90: catastrophic error: **Internal compiler error: segmentation violation 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.
compilation aborted for ifort-data-vector-section.f90 (code 1)
Interestingly, replacing line 5 by:
data b([2],[1]) / 21 / ! works
the code compiles and prints the correct result.
As far as I can tell, the sample code is valid F2018 (and likely F2008 and F2003).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm I don't know if using an array constructor as an array index is valid or not, it is hard to see a usage for that.
It also seems strange to mixed a "recent" f2003 square bracket constructor with the obsolete block data feature. Anyway I will watch this post with interest to see how it develops. An ICE is clearly a compiler problem is should either compile or throw an error message for invalid code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Harald1
thanks for the reproducer, actually it also happens without the block construct and without COMMON. I escalated it to our internal team.
Best
Tobias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Of course. vector subscripts are allowed in an array reference, but, and I was surprised by this, they are also allowed in a DATA statement. "An array section is equivalent to the sequence of its array elements in array element order."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Using OP's example, the following derivative:
block data
implicit none
integer :: b(3,1)
data b( 2 ,1) / 1 / ! b(2,1) = 1
data b([1,3],1) / 2, 3 / ! b(1,1) = 2; b(3,1) = 3
common /com/ b
end block data
Is that permitted to obtain the results in the comments?
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that is allowed. Here is what NAG does:
D:\Projects>type t.f90
block data
implicit none
integer :: b(3,1)
data b( 2 ,1) / 1 / ! b(2,1) = 1
data b([1,3],1) / 2, 3 / ! b(1,1) = 2; b(3,1) = 3
common /com/ b
end block data
program test
integer :: b(3,1)
common /com/ b
print *, b
end
D:\Projects>nagfor -o t.exe t.f90
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7120
[NAG Fortran Compiler normal termination]
D:\Projects>t.exe
2 1 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is feature is quite neat. I can think of a few times that this would have come in handy.
Will keep this in mind for the next time.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. You learn something new every day !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page