lkml.org 
[lkml]   [2000]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: beware of dead string constants
From

[I wrote]
> > > void foo (void)
> > > {
> > > if (0)
> > > printk(KERN_INFO "bar");
> > > }
> > >

[J . A . Magallon]
> Is it related to opt level ? -O3 does auto-inlining and -O2 does not
> (discovered that here, auto inlining in kernel trashes the cache...)

See for yourself. 'gcc -S' is most helpful. The above generates a
string constant "bar\0" for all optimization levels.

Jakub Jelinek claims to have fixed this particular bug in the last week
or so, although I have not downloaded and compiled recent CVS to verify
this. (Didn't someone at some point have a cgi frontend to
CVS-snapshot 'gcc -S'? I can't find it now.)

There is a similar case of scoped 'static' variables, like 'bar' here:

extern void baz (int *);
void foo (void)
{
if (0) {
static int bar[1024]; /* useless 4096-byte hole in bss */
baz(bar);
}
}

and according to Jeff Law, this case is *not* fixed yet.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:47    [W:0.062 / U:1.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site