[Bug optimization/13136] New: invalid "might be used uninitialized" warning (-O, long long)
gcc-bugzilla at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Nov 20 07:57:00 GMT 2003
GCC gives 'might be used uninitialized in this function' warning when
'long long' variable 'd' is first set to some value and then modified
in next line. Compiled with '-O -Wall'. 'long' type variable works ok.
Environment:
System: Linux haapana 2.4.22 #12 SMP Fri Nov 7 04:07:28 EET 2003 i686 unknown unknown GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: mcore-unknown-elf
configured with: /work/gcc/configure --target=mcore-elf --with-gnu-as --with-gcc --disable-nls --enable-languages=c,objc,c++ --with-gnu-ld --prefix=/emb/cross-gcc-current --program-prefix=mcore-elf- --program-suffix= -v --with-newlib --with-headers=/pub/devel/gnu/newlib-1.11.0/newlib/libc/include
How-To-Repeat:
/* ***** start of test.c ***** */
/* compile: mcore-elf-gcc -O -Wall -o test.o -c test.c */
int test(int c)
{
long long d;
d = 32000000LL << 1;
return (int)d;
}
/* ****** end of test.c ****** */
------- Additional Comments From sami dot kantoluoto at embedtronics dot fi 2003-11-20 07:57 -------
Fix:
Workaround: initialize 'd' variable to e.g. zero (0). Like:
int test(int c)
{
long long d = 0;
d = 32000000LL << 1;
return (int)d;
}
--
Summary: invalid "might be used uninitialized" warning (-O, long
long)
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sami dot kantoluoto at embedtronics dot fi
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mcore-unknown-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13136
More information about the Gcc-bugs
mailing list