To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=59722 Issue #:|59722 Summary:|gcc-4.1: undefined usage of pointers in the icu |module Component:|porting Version:|680m142 Platform:|PC URL:| OS/Version:|Linux Status:|NEW Status whiteboard:| Keywords:| Resolution:| Issue type:|PATCH Priority:|P3 Subcomponent:|code Assigned to:|mh Reported by:|pmladek
------- Additional comments from [EMAIL PROTECTED] Fri Dec 23 09:25:14 -0800 2005 ------- We had many crashes of OOo compiled with gcc-4.1. The problem was in the icu module. It used undefined operations with poiters. The following code is invalid of as 6.5.6/8 of the C standard and it caused crashes with gcc-4.1: --- cut --- # define U_MAX_PTR(base) ((void *)(((char *)(base)+0x7fffffff) > (char *)(base) ? ((char *)(base)+0x7fffffff) : (char *)-1)) --- cut --- Note that the following uses invoke undefined behavior wrt the standard --- cut --- const char* t = *target; if (targetLimit < t || sourceLimit < *source) if((size_t)(targetLimit - t) > (size_t)0x7fffffff && targetLimit > t) --- cut --- iff the two pointers you compare or get the difference from do not point to the same memory object (or one element beyond). Basically, pointer arithmetic and comparison is only defined for pointers pointing to the same memory object (or one element beyond). All this checking should be done in the respective unsigned integer types. I did not see a crash with it but I think that it was to fix it as well. I'll attach a patch. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]