Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

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

Document Table of Contents

GAP Message (Diagnostic ID 30536)

Message

Add %s option for better type-based disambiguation analysis by the compiler, if appropriate (the option will apply for the entire compilation). This will improve optimizations such as vectorization for the loop at line %d.

Advice

Use option -fnoargument-alias (Linux* OS and macOS) or /Qno-alias-args (Windows* OS) for the specified file. This option will help the compiler to optimize the loop at the specified line. The user has to verify that there is no argument-aliasing for routines in this file before applying this option for the current file. This option is particularly useful for C++ programs since it enables type-based disambiguation between pointers that are passed in as arguments, which in turn enables optimizations such as vectorization and parallelization.

Option -fargument-alias (Linux* OS and macOS) and /Qalias-args (Windows* OS) enable or disable the C/C++ rule that function arguments may be aliased. When disabling the rule, you assert that this is safe.

Example

Consider the following example that demonstrates a violation of -fnoargument-alias or /Qno-alias-args:

void f(double *p, double *q, double *r) {
  int i;
  for (i = 0; i < n; i++)
    p[i] = q[i] + r[i]; 
}
 
int n, m; 
double A[100], B[100]; 
... 
f(&A[n], &A[m], &B[0]);

Since both pointers p and q will be pointing to the same array A, there may be overlap depending on the values of n and m.

Also, you cannot use the restrict keyword for parameters p and q in the function f for this test case.

You must analyze all the callers of function f in the current file and make sure that such overlap does not exist before applying -fnoargument-alias or /Qno-alias-args or the restrict qualifier. Note that such call sites may occur in other files as well.

Verify

Make sure that the semantics of this option is obeyed for the entire compilation.

Another way to get the same effect is to add the "restrict" keyword to each pointer-typed formal parameter of the routine "%s". This allows optimizations such as vectorization to be applied to the loop at line %d. Make sure that semantics of the "restrict" pointer qualifier is satisfied; in the routine, all data accessed through the pointer must not be accessed through any other pointer.