This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 3.0.1 Freeze
- To: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Subject: Re: 3.0.1 Freeze
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 07 Aug 2001 11:04:32 -0700
- cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
> If you could look at
> <http://gcc.gnu.org/ml/gcc-bugs/2001-08/msg00180.html> and advise me a
> bit I'll happily produce a patch fixing this high priority bug producing
> buggy linux kernels on PPC.
I do not understand why this is a bug. The code that is emitted
on an x86, for:
void f() {
strcpy(c, "test string" + u);
}
is:
movl u, %edx
movl $12, %eax
subl %edx, %eax
addl $.LC0, %edx
pushl %eax
movl c, %eax
pushl %edx
pushl %eax
call memcpy
or, in C:
memcpy (c, "test string" + u, 12 - u);
That seems to work just fine, since if, say, u == 3, then 9 bytes
are copied, starting with the second `t' in `test', so we copy
"t string" and the trailing NUL.
In the pseudocode in the bug report, you had `u - 12', which would
indeed be a problem, but that is not what I am seeing.
Can you explain this in more detail?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com