Bit-Fields Impact on Stack Pointer or Stack Size

Sridhar sridhar.kr@honeywell.com
Tue Dec 20 14:15:00 GMT 2016


Hello,

I am using BIT Fields in my program with powerPC target and when I am trying
check stack usage I see some strange values for the stack pointer.

typedef struct sample_type{

unsigned int var1 : 2;
unsigned int var2 : 2;
unsigned int var3 : 2;
unsigned int var4 : 2;
unsigned int var5 : 2;
unsigned int var6 : 2;
unsigned int var7 : 2;
unsigned int var8 : 2;

}sample;

....
..

typedef struct sample1_type{

sample myvariable;
...
..

}sample1;


The variable created with type sample1 impacting lot to the stack size. I
did disassemble of the object file and checked the stwu instruction will be
having huge value in the function where the variable of structure having bit
fields is used and variable is not function scope.

If remove bit fields then stwu will have very less value for updating the
stack pointer. 

So my question is how does the Bit fields impacts the stack memory in a
function?? 

Note, I have ensure that bit fields structure is word aligned 





--
View this message in context: http://gcc.1065356.n8.nabble.com/Bit-Fields-Impact-on-Stack-Pointer-or-Stack-Size-tp1333667.html
Sent from the gcc - bugs mailing list archive at Nabble.com.



More information about the Gcc-bugs mailing list