Also, this test case: ------------------------------------------------------------ extern int f1(void); static unsigned char f2(unsigned int *def) { if (!f1()) return 0; *def = 1; return 1; } unsigned char f3(unsigned char **eoc) { unsigned int def; if (!f2(&def)) return 0; if (def) *eoc = (unsigned char *)1; else *eoc = 0; return 1; } static int f4(unsigned int *def) { if (!f1()) return 0; *def = 1; return 1; } unsigned char f5(unsigned char **eoc) { unsigned int def; if (!f4(&def)) return 0; if (def) *eoc = (unsigned char *)1; else *eoc = 0; return 1; } ------------------------------------------------------------ compiled with "gcc -Wall -O2" gives: xx.c: In function 'f3': xx.c:14: warning: 'def' may be used uninitialized in this function but doesn't complain about the same code in f5. The difference is that f4 returns "int" while f2 returns "unsigned char". This has apparently been fixed in gcc mainline - the above comes from Debian unstables' gcc (4.0.3 20051023 (prerelease) (Debian 4.0.2-3)). Compiling with "gcc -Wall -O2 -fnoinline" suppresses the warning. -- Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Attachment:
pgp5zWsteaXXe.pgp
Description: PGP signature
- References:
- 2.6.14 assorted warnings
- From: Keith Owens <[email protected]>
- Re: 2.6.14 assorted warnings
- From: Dave Jones <[email protected]>
- Re: 2.6.14 assorted warnings
- From: Alan Cox <[email protected]>
- Re: 2.6.14 assorted warnings
- From: Al Viro <[email protected]>
- Re: 2.6.14 assorted warnings
- From: Al Viro <[email protected]>
- 2.6.14 assorted warnings
- Prev by Date: Re: Broken "make install" in 2.6.14-git1
- Next by Date: Re: New (now current development process)
- Previous by thread: Re: 2.6.14 assorted warnings
- Next by thread: Re: 2.6.14 assorted warnings
- Index(es):