This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: x-files must die: rather too much at once
On Sat, Mar 10, 2001 at 11:19:26PM +1100, Fergus Henderson wrote:
>
> There is a small but non-zero chance that the grep command may get false hits,
> due to the presence of other data in the object file that happens to have
> that pattern (e.g. timestamps, for example).
Good point.
> There are several things that can be done to reduce the chance of this problem
> biting us. The simplest one is to add a longer hopefully-unique prefix
> at the start of the string that you grep for:
>
> struct {
> /* Use a hopefully unique prefix to avoid false hits. */
> char prefix[sizeof("gcc_host_endianness_test_") - 1];
We have to be careful about alignment. That string is 25 characters
long, which means 'short two' now starts on an odd address, and the
compiler might insert a pad byte between 'char h[2]' and 'short two'.
I'll incorporate a safer version of this concept.
zw