lkml.org 
[lkml]   [2002]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] C undefined behavior fix
On Thu, Jan 03, 2002 at 12:35:30AM +0000, David Woodhouse wrote:
> (cc list trimmed)
>
> alan@lxorguk.ukuu.org.uk said:
> > If you want a strcpy that isnt strcpy then change its name or use a
> > different language 8)
>
> The former is not necessarily sufficient in this case. You've still done the
> broken pointer arithmetic, so even if the function isn't called strcpy() the
> compiler is _still_ entitled to replace it with a call to memcpy() or even
> machine_restart() before sleeping with your mother and starting WW III.

No, that's not true. We're passing a pointer as an argument. It is a
valid pointer - dereferencing it may not be valid, but the pointer is
perfectly legal! There is nothing wrong with this case. The problem
lies in calling a function whose name is special to GCC and to the C
language, which GCC can then transform.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.280 / U:0.120 seconds]
©2003-2011 Jasper Spaans. Advertise on this site