Bug 13025 - incorrect "might be used uninitialized in this function" warning (no, not the usual problem)
Summary: incorrect "might be used uninitialized in this function" warning (no, not the...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2003-11-12 17:26 UTC by David Gay
Modified: 2005-07-23 22:49 UTC (History)
4 users (show)

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


Attachments
Test case that reproduces bug (200 bytes, text/plain)
2003-11-12 17:27 UTC, David Gay
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gay 2003-11-12 17:26:12 UTC
The attached file reports 
  foo.c: In function `main':
  foo.c:19: warning: `result1' might be used uninitialized in this function
when compiled with avr-gcc -Os -Wall -c foo.c

gcc was built with
./configure --host=i686-pc-linux-gnu --enable-languages=c --target=avr --disable-nls

The same problem shows up in gcc-ss-3_3-20031110


foo.c:
char a;
 
static inline char rcombine(char r1, char r2)
{
  return r1 ? 0 : r2;
}
 
static inline char Mod1_xx(void)
{
  int i;
 
  for (i = 0; i < 6; i++) a += i;
 
  return 1;
}
 
static inline char Mod1_StdControl_init(void)
{
  char result1;
  char result2;
 
  result1 = rcombine(2, 1);
  result2 = Mod1_xx();
  result1 = rcombine(result1, result2);
  return result1;
}
 
int   main(void)
{
  Mod1_StdControl_init();
  return 0;
}
Comment 1 David Gay 2003-11-12 17:27:03 UTC
Created attachment 5123 [details]
Test case that reproduces bug
Comment 2 Andrew Pinski 2003-12-19 14:33:55 UTC
Fixed on the mainline (20031219)..