Oh fsck! gcc is hosed. I just tried out this BS module:
---
#include <linux/module.h>
int g = 0;
void func_int(int *y)
{
*y = 0;
}
int warn_here(void)
{
int x;
printk("x=%d\n",x);
return 0;
}
int but_not_here(void)
{
int y;
printk("y=%d\n",y);
if (g) {
func_int(&y);
}
return 0;
}
static int __init blah_init(void)
{
warn_here();
but_not_here();
return 0;
}
static void __exit blah_exit(void)
{
printk(KERN_INFO "Bye bye!\n");
}
module_init(blah_init);
module_exit(blah_exit);
MODULE_AUTHOR("My name here");
MODULE_DESCRIPTION("blah!");
MODULE_LICENSE("GPL");
---
And this is what I got!
CC [M] /home/rostedt/c/modules/warning.o
/home/rostedt/c/modules/warning.c: In function 'warn_here':
/home/rostedt/c/modules/warning.c:14: warning: 'x' is used uninitialized in this function
Building modules, stage 2.
Why the fsck isn't the func but_not_here not getting a warning for the
first use of printk?? If I remove the if statement it gives me the
warning. Hell, that if statement isn't even entered (g = 0).
If you remove the warn_here function altogether, this module gets no
warnings!!!
OK, this really bothers me :(
btw, if you are wondering. I did load the module, and here's the output
from dmesg:
x=-124784640
y=-124784640
And I even tried it with removing warn me, compiled with no warnings and
then got this:
y=134514958
Huh!
-- Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]