This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/13136] New: invalid "might be used uninitialized" warning (-O, long long)
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Nov 2003 07:57:16 -0000
- Subject: [Bug optimization/13136] New: invalid "might be used uninitialized" warning (-O, long long)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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