This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: mips gcc -O1: Address exception error on store doubleword
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: "Alex Gonzalez" <langabe at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 9 Aug 2007 17:17:46 +0100
- Subject: Re: mips gcc -O1: Address exception error on store doubleword
- References: <c58a7a270708090757p158b302fn3fc996aac9320a1b@mail.gmail.com>
[redirected to gcc-help]
Alex Gonzalez writes:
> 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?
I'm guessing you're doing something illegal, like casting an unaligned
pointer to a PVAR *. It would help if you could post a short test
case (complete, runnable) that shows the problem.
Andrew.