Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

VOLATILE on POINTER

$
0
0

The documentation is a little unclear on this, or perhaps I'm mis-reading it.  If I were to declare a variable as a POINTER, and then mark it as VOLATILE, is this marking the pointer as VOLATILE, or the memory region that it points to?  I need to mark the latter.  In this example, I have a structure, BAR, which I want to be able to grow in size as the program progresses, and I have already mapped the HMM common area to global shared memory between multiple processes, as well as the contents of BAR.  When I expand the array, I call a routine that remaps the new addresses of BAR to global, but since they're in shared memory, I need to mark the entire BAR structure as VOLATILE, not just the pointers.

STRUCTURE   /FOO/
    INTEGER*4   A
    INTEGER*4   B
    INTEGER*4   C
END STRUCTURE

BYTE    BEG_ADR
INTEGER*4    NUM_ALLOCATED
INTEGER*4    INDEX
BYTE    END_ADR
TYPE(FOO), POINTER :: BAR(:)

COMMON/HMM/
&  BEG_ADR,&  NUM_ALLOCATED,&  INDEX,&  BAR,&  END_ADR
VOLATILE/HMM/
VOLATILE BAR

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>