Hi All
I have similar question as for arm
http://gcc.gnu.org/ml/gcc/2007-01/msg00691.html
consider the following program.
e.g..
----------------- align.c -----------------
int main()
{
int bc;
char a[6];
int ac;

bc = 0xffffffff;
/* fill with zeros.  */
a[0] = 0x00;
a[1] = 0x01;
 a[2] = 0x02;
  a[3] = 0x03;
   a[4] = 0x04;
    a[5] = 0x05;
        
    ac=0xeeeeeeee;
make(a);
}
void make(char* a)
{
*(unsigned long*)a = 0x12345678;
}
--------------------------------------- End ---------------------------

the local variable for function main are pushed on the stack
as ac(4byte) + bc(4bytes)+a[6](6bytes)+2bytes padding
stating address of the char array now starts from an
unaligned address and is acessed by the instruction
  strb    r3, [fp, #-26]

which gives a very wrong result when passed to the function make.

Previously we were using an older version of gcc
which actually aligned the address of the char array also.

Older version of gcc : v2.94
New Version : v4.0.1

Is the compiler doing a right thing or is it a bug??
--
Thanks,
Inder

Reply via email to