This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36550] New: Wrong "may be used uninitialized" warning
- From: "aldot at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jun 2008 09:53:08 -0000
- Subject: [Bug middle-end/36550] New: Wrong "may be used uninitialized" warning
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Yet another one. It behaves the same for 4.1.2 and current trunk.
$ gcc -Os -Wuninitialized -c uninit-J.c
uninit-J.c: In function 'pr':
uninit-J.c:7: warning: 'bug' may be used uninitialized in this function
$ cat uninit-J.c
/* { dg-do compile } */
/* { dg-options "-Os -Wuninitialized" } */
void bail(void) __attribute__((noreturn));
unsigned check(void);
int pr(char**argv)
{
char *bug;
if (check()) {
if (*argv)
bug = *++argv;
} else {
bug = *argv++;
if (!*argv)
bail();
}
/* now bug is set except if (check() && !*argv) */
if (check()) {
if (!*argv)
return 0;
}
/* if we ever get here then bug is set */
return *bug != 'X';
}
--
Summary: Wrong "may be used uninitialized" warning
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aldot at gcc dot gnu dot org
OtherBugsDependingO 24639
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36550