lkml.org 
[lkml]   [2002]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] C undefined behavior fix
On Wed, Jan 02, 2002 at 11:23:21PM +0100, jtv wrote:
> On Wed, Jan 02, 2002 at 03:05:48PM -0700, Tom Rini wrote:
> >
> > Well, the problem is that we aren't running where the compiler thinks we
> > are yet. So what would the right fix be for this?
>
> Obviously -ffreestanding isn't, because this problem could crop up pretty
> much anywhere. The involvement of standard library functions is almost
> coincidence and so -ffreestanding would only fix the current symptom.

After thinking about this a bit more, why wouldn't this be the fix? The
problem is that gcc is assuming that this is a 'normal' program (or in
this case, part of a program) and that it, and that the standard rules
apply, so it optimizes the strcpy into a memcpy. But in this small bit
of the kernel, it's not. It's not even using the 'standard library
functions', but what the kernel provides. This problem can only crop up
in the time before we finish moving ourself around.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
-
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:18    [W:0.171 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site