This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Wierd sparc sunos4 intermittant SEGV during bootstrap in libgcc2.a
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Wierd sparc sunos4 intermittant SEGV during bootstrap in libgcc2.a
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Mon, 06 Mar 2000 12:48:54 -0800
- cc: davem at redhat dot com, egcs-bugs at egcs dot cygnus dot com, rth at cygnus dot com
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