Re: mips gcc -O1: Address exception error on store doubleword

2007-08-10 Thread Andrew Haley
Alex Gonzalez writes: > Hi, trying to come up with a testcase we figured out what the problem could > be. > > When the optimizer is on and memcpy sees that it is copying a > struct with double words in it, it will assume that the struct > starts on an 8 byte boundary and use double word loa

Re: mips gcc -O1: Address exception error on store doubleword

2007-08-10 Thread Alex Gonzalez
Hi, trying to come up with a testcase we figured out what the problem could be. When the optimizer is on and memcpy sees that it is copying a struct with double words in it, it will assume that the struct starts on an 8 byte boundary and use double word loads and stores. This is a safe assumption,

Re: mips gcc -O1: Address exception error on store doubleword

2007-08-09 Thread Paul Brook
On Thursday 09 August 2007, Alex Gonzalez wrote: > Hi, > > I'll try to come up with a short test. > > I have narrowed it a bit more. The PVAR structure contains a long long > variable ( with a sizeof 8 and an alignof 8 for my architecture). If I > take out the long long variable, the compiler uses

Re: mips gcc -O1: Address exception error on store doubleword

2007-08-09 Thread Alex Gonzalez
Hi, I'll try to come up with a short test. I have narrowed it a bit more. The PVAR structure contains a long long variable ( with a sizeof 8 and an alignof 8 for my architecture). If I take out the long long variable, the compiler uses sdl instructions instead of sd and the exception doesn't happ

Re: mips gcc -O1: Address exception error on store doubleword

2007-08-09 Thread David Daney
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 cause

Re: mips gcc -O1: Address exception error on store doubleword

2007-08-09 Thread Andreas Schwab
"Alex Gonzalez" <[EMAIL PROTECTED]> writes: > 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? If the pointers are not correctly aligned for their target type then you are in

mips gcc -O1: Address exception error on store doubleword

2007-08-09 Thread Alex Gonzalez
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