This is the mail archive of the gcc@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: 3.0.1 Freeze


> 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


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