реклама на сайте
подробности

 
 
> EWARM 5.20 - Опция оптимизации: Type-based alias analysis, кто "сталкивался" и что думаете
Faradey
сообщение Dec 2 2008, 16:40
Сообщение #1


Частый гость
**

Группа: Свой
Сообщений: 127
Регистрация: 31-05-06
Из: Belarus, Minsk
Пользователь №: 17 638



IAR C/C++ Compiler for ARM 5.20.3.51069 (5.20.3.51069)

интересная опция оптимизатора - Type-based alias analysis
в проекте под STM32F103VB на Си при выбранном "Allow IAR extensions" ее включение приводит к тому, что код "не работает" вообще.
причем вот что пишут в "IAR C/C++ Development Guide":

Цитата
Type-based alias analysis
When two or more pointers reference the same memory location, these pointers are said
to be aliases for each other. The existence of aliases makes optimization more difficult
because it is not necessarily known at compile time whether a particular value is being
changed.
Type-based alias analysis optimization assumes that all accesses to an object will take
place using its declared type or as a char type. This assumption lets the compiler detect
whether pointers may reference the same memory location or not.
Type-based alias analysis is performed at optimization level High. For ISO/ANSI
standard-conforming C or C++ application code, this optimization can reduce code size
and execution time. However, non-standard-conforming C or C++ code might result in
the compiler producing code that leads to unexpected behavior. Therefore, it is possible
to turn this optimization off.
Note: This option has no effect at optimization levels None, Low, and Medium.

Example
short f(short * p1, long * p2)
{
*p2 = 0;
*p1 = 1;
return *p2;
}
With type-based alias analysis, it is assumed that a write access to the short pointed to
by p1 cannot affect the long value that p2 points to. Thus, it is known at compile time
that this function returns 0. However, in non-standard-conforming C or C++ code these
pointers could overlap each other by being part of the same union. By using explicit
casts, you can also force pointers of different pointer types to point to the same memory
location.


кто что думает по этому поводу?

З.Ы. ворнингов при компиляции, сборке нет.


--------------------
Завтра пойму, что нужно было сделать вчера...
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 21st July 2025 - 17:01
Рейтинг@Mail.ru


Страница сгенерированна за 0.01334 секунд с 7
ELECTRONIX ©2004-2016