This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/31309] [4.1/4.2/4.3 Regression] 6 byte assignment at end of structure reads/writes past end of structure causing SEGV when that memory is not accessable.
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2007 14:05:22 -0000
- Subject: [Bug middle-end/31309] [4.1/4.2/4.3 Regression] 6 byte assignment at end of structure reads/writes past end of structure causing SEGV when that memory is not accessable.
- References: <bug-31309-12838@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from rguenth at gcc dot gnu dot org 2007-07-06 14:05 -------
The following testcase exposes the problem in Initialize()
struct STRUCT_6_BYTES
{
unsigned char slot[sizeof(unsigned short)];
unsigned char page[sizeof(unsigned int)];
};
struct SQLU_DICT_INFO_0
{
void * pBlah;
char bSomeFlag1;
char bSomeFlag2;
STRUCT_6_BYTES dRID;
};
STRUCT_6_BYTES INIT_6_BYTES_ZERO(void)
{
STRUCT_6_BYTES ridOut = { {0,0}, {0,0,0,0} } ;
return ridOut;
}
void Initialize(SQLU_DICT_INFO_0 *pDictRidderInfo)
{
pDictRidderInfo->bSomeFlag1 = 0;
pDictRidderInfo->bSomeFlag2 = 0;
pDictRidderInfo->dRID = INIT_6_BYTES_ZERO();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31309