I'm running into an out of bounds error using TinyXML with pgCC 11.9-0. This happens very early on. Here's the call:
TiXmlDocument doc("abc.xml");
which generates the error:
PGC++ F-Subscript out of range for array _42539_8_str (tinystr.h: 229)
subscript=3, upper bound=0, dimension=1
when compiled with "-g -Mbounds -Ktrap=fp". Looking at tinystr.h, I dont understand how the code should work.
structRep{size_typesize,capacity;charstr[1];};voidinit(size_typesz,size_typecap){if(cap){//Lee:theoriginalform://rep_=static_cast<Rep*>(operatornew(sizeof(Rep)+cap));//doesn't work in some cases of new being overloaded. Switching//tothenormalallocation,althoughusean'int'forsystems//thatareoverlypickyaboutstructurealignment.constsize_typebytesNeeded=sizeof(Rep)+cap;constsize_typeintsNeeded=(bytesNeeded+sizeof(int)-1)/sizeof(int);rep_=reinterpret_cast<Rep*>(newint[intsNeeded]);rep_->str[rep_->size=sz]='\0';rep_->capacity=cap;}...}
The error occurs on line
rep_->str[ rep_->size = sz ] = '\0';
This doesn't make sense to me. Rep::str is a character array with 1 element, but sz is the length of the string being initialized. With "abc.xml", sz==7.
What am I doing wrong/not understanding?
Thanks!
Pete
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm running into an out of bounds error using TinyXML with pgCC 11.9-0. This happens very early on. Here's the call:
which generates the error:
when compiled with "-g -Mbounds -Ktrap=fp". Looking at tinystr.h, I dont understand how the code should work.
The error occurs on line
rep_->str[ rep_->size = sz ] = '\0';
This doesn't make sense to me. Rep::str is a character array with 1 element, but sz is the length of the string being initialized. With "abc.xml", sz==7.
What am I doing wrong/not understanding?
Thanks!
Pete