On Friday, June 15 at 02:59 PM, quoth Brendan Cully:
On Friday, 15 June 2007 at 22:08, Vladim'ir Marek wrote:Hi, I found bug in SS11 which is triggered by mutt source. It makes function crc_matches return false even if the crc is correct. This virtually disables header cache.unsigned int mycrc = 0; to static unsigned int mycrc = 0;[...]Wow, that's voodoo. I don't see any harm in making the change though.Making the variable static makes compiler to store the value to physical memory and not just to register. I can confirm that on SS12 the problemyou'd think &mycrc would have the same effect :)
It *should*, but I guess that's the very definition of a bug, eh? :)
no longer exists. But at the same time, SS11 may not be fixed, since it is not priority anymore ...I'll probably apply it. I'm just giving it time to see if any other C gurus comment.
Well... there's the obvious comment, which is that if you're relying on mycrc being initialized to zero in the function, making it static will break that, so you'd need to add a separate mycrc=0; line in after it is declared, because the existing initialization won't take care of that.
The other problem with making it static is that it prevents the compiler from doing certain kinds of optimization. That's not a performance-critical function, but... I'd be somewhat uncomfortable with adding goofy-looking code to work around compiler bugs---especially when the bug has been fixed in the current version of the compiler. I mean, we aren't still working around gcc 1.0 bugs, why work around SS11 bugs? If anything, put it in an #ifdef, such as:
#ifdef __SUN11__ /* or whatever signifies that compiler */ static int mycrc; mycrc = 0; #else int mycrc = 0; #endif ~Kyle --America will never be destroyed from the outside. If we falter and lose our freedoms, it will be because we destroyed ourselves.
-- Abraham Lincoln
Description: PGP signature