mips gcc -O1: Address exception error on store doubleword

David Daney ddaney@avtrex.com
Thu Aug 9 16:40:00 GMT 2007


Alex Gonzalez wrote:
> Hi,
>
> I am seeing an address error exception caused by the gcc optimizer -O1.
>
> I have narrowed it down to the following function:
>
> static void varcopy(PVAR *pvar1, PVAR *pvar2) {
>     memcpy(pvar1,pvar2,sizeof(PVAR));
> }
>
> Being the sizeof(PVAR) 160 bytes.
>
> The exception is caused on an sd instruction when the input is not
> aligned on a doubleword boundary.
>
> I was under the assumption that the compiler made sure that it doesn't
> store a doubleword that is not aligned on a doubleword boundary. Is
> this a bug in the optimizer?
>
> I am using a gcc mips64 cross-compiler,
>
> mips64-linux-gnu-gcc (GCC) 3.3-mips64linux-031001
>
> Has anyone experienced this problem before?
>   
In order to investigate we would need a self contained test case (i.e. 
the definition of PVAR must be included).  Also it would be nice if you 
could try it on a current version of GCC (4.2.1 perhaps).

David Daney



More information about the Gcc mailing list