Messages in this thread |  | | Date | Tue, 21 Nov 2000 19:14:32 -0600 | Subject | Re: beware of dead string constants | From | Peter Samuelson <> |
| |
[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/
|  |