This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: warning: `x' might be used uninitialised in this function
- To: "'Alexandre Oliva'" <oliva at dcc dot unicamp dot br>
- Subject: RE: warning: `x' might be used uninitialised in this function
- From: Giuliano Procida <GProcida at madge dot com>
- Date: Wed, 17 Mar 1999 10:54:59 -0000
- Cc: "'egcs-bugs at cygnus dot com'" <egcs-bugs at cygnus dot com>
Here is an example which shows the problem.
// cc -O -Wuninitialized -c test3.c -o test3.o
typedef unsigned short u16;
typedef unsigned short __u16;
typedef unsigned int __u32;
typedef unsigned int u32;
typedef struct {
u32 vc; // comment this line out and you get no warnings!
u32 flags;
u32 rate;
} command;
static __inline__ __const__ __u16 ___arch__swab16(__u16 y) {
__asm__("xchgb %b0,%h0" : "=q" (y) : "0" (y));
return y;
}
extern __inline__ __const__ __u16 __fswab16(__u16 x) {
return ___arch__swab16( x ) ;
}
int main (void) {
u16 tx_rate_bits;
u16 tx_vc_bits;
command cmd;
cmd.flags = (__builtin_constant_p((__u16)(tx_vc_bits))
? ((__u16)( (((__u16)(tx_vc_bits) & (__u16)0x00ffU) << 8) |
(((__u16)(tx_vc_bits) & (__u16)0xff00U) >> 8) ))
: __fswab16(tx_vc_bits)) ;
cmd.rate = (__builtin_constant_p((__u16)(tx_rate_bits))
? ((__u16)( (((__u16)(tx_rate_bits) & (__u16)0x00ffU) << 8) |
(((__u16)(tx_rate_bits) & (__u16)0xff00U) >> 8) ))
: __fswab16(tx_rate_bits)) ;
return 0;
}
Giuliano.
--
gprocida@madge.com
myxie@debian.org