Today I got haunted by a rather old bug that surfaced on changing the size of a basic data type. At first it was a bit strange as the program in question did run fine on one machine and not on the other, both of which are SPARCstations running Solaris 7 with the same patches installed.
One one machine the program did bus error shortly after connecting from a Mac client. As it turned out one machine was running with one crucial library compiled in debug mode without optimization. The bug was that in this library the structure alignment requirements did change due to changing off_t to 64 bits as the result of the large file compile environment.
The library did place these structures into a shared memory segment using it's own allocator, but did align only a 32 bit boundary. The C compiler without optimizer did pad all structures to at least 64 bit boundaries and thus the problem did not appear. With the optimizer turned on not all of the structures placed into shared memory are aligned to 64 bits and thus at some point an off_t struct member was not properly aligned for the SPARC processor.
As one can see again a programming error (failing to provide the proper alignment) can go unnoticed for a long time and a change in the environment can make it pop up in code believed to be rock solid.
