Skip to main content
Knowledgebase
Home
Renesas Singapore - Knowledgebase

What is the –Xalias option?

Latest Updated:02/27/2015

Question:

What is the –Xalias option?

Answer:

Specifying the -Xalias=ansi option causes optimization in consideration of the types of data pointed to by pointers, based on the ANSI C standard. Where the types of data a pointer points to differ, the ANSI standard allows a pointer to point to different objects.
Accordingly, when the code conforms to the ANSI standard and the -Xalias=ansi option is specified, optimization proceeds in consideration of pointers that point to objects of different types. This improve the efficiency of code.

Example:

   ----------------------------
   long a,b;
   void func(short *p) {
      a=0;
      *p=1;
      b=a;
   }
   ----------------------------

Since "p" is a pointer to a variable of the short type, when the -Xalias=ansi option is specified, *p, a, and b are recognized as being at separate locations or areas of memory. In this case, 'b=a;' is optimized as 'b=0;' because '*p=1;' does not overwrite 'a=0;'. Such adjustments improve the efficiency of code.

For -Xalias=noansi, the value of "a" is loaded to be stored in "b" for 'b=a', on the assumption that '*p=1;' may overwrite 'a=0;'.
Accordingly, if pointer "p" does indicate the address of variable "a", the result of execution will differ according to whether the -Xalias=ansi or -Xalias=noansi option is specified.

Suitable Products
C Compiler Package for RH850 Family