- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The documentation for the non-standard LOC() function in the IFort 15 manual at https://software.intel.com/en-us/compiler_15.0_ug_f contains example code containing Cray pointers, and readers who may have never heard of Cray pointers may find the code confusing. Perhaps the adjective 'Cray' can be added to the word 'pointer' in the comments in the code to obviate this confusion.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, we don't call them Cray pointers - we call them "integer pointers". Cray doesn't want you to call them Cray pointers either, but accept that everyone does. I will suggest an edit to this text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wow - that example has a LOT more wrong than just what we call the pointer. Neither the Fortran code nor the C code would even compile, and the example itself is ridiculous. I will come up with something better.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The buggy example code (square brackets for Fortran dimensions; setting an integer equal to a float array in the C function; the non-use of the array VAR associated with the integer pointer; expecting the local array a[] in the C function to remain allocated after leaving the C function) is the same as it was in the CVF 6 reference manual!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not surprising.... We have a project underway to take all of the manual examples and put them in a test suite. You didn't mention that the example works only for 32-bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And the example goes back further than that - it came from the Microsoft Fortran PowerStation reference, with the same errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
And the example goes back further than that - it came from the Microsoft Fortran PowerStation reference, with the same errors.
I binned a box of stuff last year and one of the contents was the Powerstation 1.0 manual. I almost wish I had kept it to have a laugh now and again. Actually Powerstation was a big plus when it came our as it gave access to extended memory :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have asked that the example be replaced with this:
! Example of using the LOC intrinsic integer :: array(2) = [10,20] integer :: t pointer (p,t) ! Integer pointer extension ! p is pointer, t is pointee (target) ! This declares p as an address-sized integer p = loc(array(1)) ! Address of array(1) print *, t ! Prints 10 p = loc(array(2)) ! Address of array(2) print *, t ! Prints 20
I also suggested adding text recommending use of the ISO_C_BINDING functions instead, though those are not a direct replacement for LOC (and integer pointers).

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