Bug 13136 - invalid "might be used uninitialized" warning (-O, long long)
Summary: invalid "might be used uninitialized" warning (-O, long long)
Status: RESOLVED DUPLICATE of bug 12792
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-20 07:57 UTC by Sami Kantoluoto
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: mcore-unknown-elf
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Kantoluoto 2003-11-20 07:57:14 UTC
	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 ****** */
Comment 1 Sami Kantoluoto 2003-11-20 07:57:14 UTC
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;
	}
Comment 2 Andrew Pinski 2003-11-20 08:01:37 UTC
Related to bug 12792 (filed for m68k).
Actually I think its analysis is to be able to mark it as a dup of it then:
* life_analysis() does not track subregister modifications -- if you don't
modify the whole register with a single set, it considers the register
unused.

*** This bug has been marked as a duplicate of 12792 ***