lkml.org 
[lkml]   [2009]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2/8] compiler-gcc.h: add more comments to RELOC_HIDE
On Wed, 14 Jan 2009, Linus Torvalds wrote:

> > > The cast should cause the C compiler to drop all assumptions about size.
> >
> > No, and that's the point. Sorry, at this point you need to talk to a gcc expert. As I have said, I did and I believe what he told me.
>
> Yeah, I personally believe in the "should cause the C compiler" part, but
> gcc doesn't work that way. It will remember where the value came from,
> even when the pointer has been cast to something else.

If so then the compiler is crap. Casting a pointer to long needs to
get a scalar without assumptions about the size of the structure that the
pointer was going to remaining a factor.

All of this originated in some discussion in the 2.5.X days. Could we make
sure that this is indeed the case?I have never seen any ill effect from
the casts to long nor do the failure scenarios given here make too much
sense (like adding a pointer to the address of a constant string passed as
the source argument to strcpy????).

From the include/compiler*.h files it looks as if we are supporting 3
classes of compilers. Of those only gcc has this sickness.




\
 
 \ /
  Last update: 2009-01-15 20:23    [W:0.196 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site