Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

safe-cray-ptr, Qsafe-cray-ptr

Tells the compiler that Cray* pointers do not alias other variables.

Syntax

Linux:

-safe-cray-ptr

macOS:

-safe-cray-ptr

Windows:

/Qsafe-cray-ptr

Arguments

None

Default

OFF

The compiler assumes that Cray pointers alias other variables.

Description

This option tells the compiler that Cray pointers do not alias (that is, do not specify sharing memory with) other variables.

IDE Equivalent

Visual Studio: Data > Assume CRAY Pointers Do Not Share Memory Locations (/Qsafe-cray-ptr)

Alternate Options

None

Example

Consider the following:

pointer (pb, b)
pb = getstorage()
do i = 1, n
b(i) = a(i) + 1
enddo

By default, the compiler assumes that b and a are aliased. To prevent such an assumption, specify the -safe-cray-ptr (Linux* and macOS) or /Qsafe-cray-ptr (Windows*) option, and the compiler will treat b(i) and a(i) as independent of each other.

However, if the variables are intended to be aliased with Cray pointers, using the option produces incorrect results. In the following example, you should not use the option:

pointer (pb, b)
pb = loc(a(2))
do i=1, n
b(i) = a(i) +1
enddo