This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]