- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this example what array bounds would you expect for b ?
[bash]real a(4) real, allocatable :: b(:) integer i do i = 1 to 4 a(i) = float(i) end do b = a(3:4) [/bash]IVF gives bounds 3 to 4. It strikes me as wrong but I dont have a copy of the full standard.
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, the code you posted would not compile as it has syntax errors. It is not clear to me how you are determining that "IVF gives bounds 3 to 4". I will comment that, unless you compile with /assume:realloc_lhs, b will not get allocated according to the F2003 specs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, I thought the same at first glance. The snippet above when compiled with /assume:realloc_lih gives 3 and 4. Without the /assume, I get 1 and 0 with IVF11.1065.
The 2003 handbook Adams et. al , Chapter 7, page 236 (and Metcalf et al 95/2003 explained, chapter 12, page 243) has the following for assignment of variable = expression ---
4. If the component is allocatable
a. if it is allocated, it is deallocated.
b. if the corresponding component of the expression is allocated, the variable
component is allocated with the same dynamic type and type parameters and,
if it is an array, with the same bounds. The value of the expression component
is then assigned to the variable component using defined assignment if there is
a consistent type-bound assignment available; otherwise, intrinsic assignment
is used.
Although it is mentioned in the context of the component of the derived type, it should be the same for intrinsic types as well.
I think then IVF is incorrectly (in the original post, I had typed "correctly"; hence edited with italics) giving the bounds when compiled with appropriate flag.
Abhi
p.s. For what it is worth, XLFortran version 11 is giving bounds 1 and 2. :(
The 2003 handbook Adams et. al , Chapter 7, page 236 (and Metcalf et al 95/2003 explained, chapter 12, page 243) has the following for assignment of variable = expression ---
4. If the component is allocatable
a. if it is allocated, it is deallocated.
b. if the corresponding component of the expression is allocated, the variable
component is allocated with the same dynamic type and type parameters and,
if it is an array, with the same bounds. The value of the expression component
is then assigned to the variable component using defined assignment if there is
a consistent type-bound assignment available; otherwise, intrinsic assignment
is used.
Although it is mentioned in the context of the component of the derived type, it should be the same for intrinsic types as well.
I think then IVF is incorrectly (in the original post, I had typed "correctly"; hence edited with italics) giving the bounds when compiled with appropriate flag.
Abhi
p.s. For what it is worth, XLFortran version 11 is giving bounds 1 and 2. :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code you posted does not compile - the syntax for the DO loop is incorrect. It's also incomplete. I corrected this and added code to view the bounds and can see that array B has bounds 3:4.
xlf is correct here - the bounds of the expression a(3:4) are 1:2. You can see this with the following test:
I will report this to the developers.
xlf is correct here - the bounds of the expression a(3:4) are 1:2. You can see this with the following test:
[fortran]real a(4)
real, allocatable :: b(:)
integer i
do i = 1 , 4
a(i) = float(i)
end do
b = a(3:4)
print *, b
print *, lbound(b), ubound(b)
print *, lbound(a(3:4)), ubound(a(3:4))
end[/fortran]
I will report this to the developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
A loosely related topic of pointer remapping: (http://software.intel.com/en-us/forums/showthread.php?t=67515&o=a&s=lr).
Is this going to make it in August or later?
Abhi
A loosely related topic of pointer remapping: (http://software.intel.com/en-us/forums/showthread.php?t=67515&o=a&s=lr).
Is this going to make it in August or later?
Abhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Issue ID is DPD200157905. Pointer remapping is expected to be in the end-of-year release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve, sorry about the do loop syntax booboo.
Yes I did mean you to use /assume:realloc_lhs since we are testing F2003 conformance.
The problem showed up in a big project with array index checking on when I attempted to migrate to /assume:realloc_lhs for the whole project.
Yes I did mean you to use /assume:realloc_lhs since we are testing F2003 conformance.
The problem showed up in a big project with array index checking on when I attempted to migrate to /assume:realloc_lhs for the whole project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The bug will be fixed in a future update.

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