Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

-fstack-usage option

Pawel_S_Intel
Employee
671 Views

Hi,

Does Intel C++ Compiler support "-fstack-usage" option as supported by GCC? Or something similar?

Regards

Pawel

0 Kudos
3 Replies
SergeyKostrov
Valued Contributor II
671 Views
I did a quick verification with a MinGW C++ compiler ( GCC-like for Windows ) and it supports the following stack-like options: ... -fstack-check Insert stack checking code into the program -fstack-limit This switch lacks documentation -fstack-limit-register= Trap if the stack goes past -fstack-limit-symbol= Trap if the stack goes past symbol ... Next, Intel C++ compiler version 12.x.x ( for Windows ) supports the only stack-like option: ... /Qfp-stack-check - enable fp stack checking after every function/procedure call ... Note: There are also several options for stack alignment, like /Qsfalign8, /Qsfalign16, /Qsfalign and /Qsfalign-. My question is what exactly do you need to achieve?
0 Kudos
Pawel_S_Intel
Employee
671 Views

I am working on a firmware that will work on HW with limited memory.

We would like to use the hint from compiler to optimize stack size.

0 Kudos
SergeyKostrov
Valued Contributor II
671 Views
>>I am working on a firmware that will work on HW with limited memory. What is a smallest amount of memory that HW is going to have? >>We would like to use the hint from compiler to optimize stack size. There are several kinds of stacks: - A stack for an application ( controlled with Stack Reserve and Stack Commit values of a linker ) - A stack for a thread ( on a Win32 platform it is controlled by a parameter passed to a CreateThread function ) - A stack for OpenMP threads ( controlled by OMP_STACKSIZE environment variable ) PS: By the way, I have a Pentium II system ( a notebook / 32-bit WIndows 2000 Professional Edition OS ) with 128MB of physical memory memory and I use it for harsh-stress testing and it also simulates an embedded system with very limited resources. I tested a set of algorithms with 2GB Virtual Memory and everything worked. Since the software is highly configurable I could create an executable just ~25KB in size, however it doesn't do too much but it can output a "Hello, World!" expression in that case. A regular, more practical, size of an executable could be about a couple of hundreds KBs. In overall, I completed lots of different tests including verification of maximum number of recursive calls, for Quick, Heap and Merge Sorting algorithms, and Strassen's matrix multiplication. I agree that a stack size for a really small embedded system needs to be taken into account seriously.
0 Kudos
Reply