SPRU514Z July 2001 – October 2023 SM320F28335-EP
The compiler, when invoked with optimization, assumes that any variable whose address is passed as an argument to a function will not be subsequently modified by an alias set up in the called function. Examples include:
If you use aliases like this in your code, you must use the --aliased_variables option when you are optimizing your code. For example, if your code is similar to this, use the --aliased_variables option:
int *glob_ptr;
g()
{
int x = 1;
int *p = f(&x);
*p = 5; /* p aliases x */
*glob_ptr = 10; /* glob_ptr aliases x */
h(x);
}
int *f(int *arg)
{
glob_ptr = arg;
return arg;
}