This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Wierd sparc sunos4 intermittant SEGV during bootstrap in libgcc2.a


	Do you know of a way to reliably detect this bug in strncmp and test
	for it in autoconf?  If so, I can write something for libiberty and
	provide a replacement strncmp.

I don't have any simple testcase, but it is very reproducible on the SunOS4
machine here.

strncmp has code to compare 4 bytes at a time.  If you pass an unaligned
string, then it reads a word ahead, and then extracts an aligned word from
the 8 bytes that it read.  So if you put a string near the end of memory,
and the string is not 4 byte aligned, and you pass it as the second argument
to strncmp, you can get a read past the end of memory when it tried to extract
an aligned word.

	(BTW, are you saying you *don't* think it has to do with the sparc
	flush instructions or just that I should check mmap first?)

I was just reporting a bug that I knew about, that I suspected you did not
know about.  I was not making any comment on the sparc flush instruction.

Jim

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]