| Subject: | [Bug middle-end/36296] wrong warning about potential uninitialized variable |
|---|---|
| From: | "vincent at vinc17 dot org" |
| Date: | 18 Aug 2008 22:58:26 -0000 |
------- Comment #9 from vincent at vinc17 dot org 2008-08-18 22:58 -------
(In reply to comment #8)
> Please provide a preprocessed reduced testcase as similar to the original as
> possible.
Here's a similar testcase.
$ cat tst.c
void *foo (void);
void bar (void *);
void f (void)
{
int init = 0;
void *p;
while (1)
{
if (init == 0)
{
p = foo ();
init = 2;
}
bar (p);
}
}
$ gcc -Wall -O2 tst.c -c
tst.c: In function 'f':
tst.c:7: warning: 'p' may be used uninitialized in this function
This is quite strange: if I replace the value 2 by 1 or if I replace foo() by
0, the warning is no longer displayed.
Note: in the reality (in MPFR), the variable I called init here is the size of
the array (0 when the array hasn't been allocated yet).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [Bug target/35658] between -funroll-loops -fno-automatic -O2 and common block variable, sje at cup dot hp dot com |
|---|---|
| Next by Date: | [Bug bootstrap/37155] [4.4 Regression] Revision 139207 failed to bootstrap on Linux/ia64, hjl dot tools at gmail dot com |
| Previous by Thread: | [Bug middle-end/36296] wrong warning about potential uninitialized variable, manu at gcc dot gnu dot org |
| Next by Thread: | [Bug middle-end/36550] Wrong "may be used uninitialized" warning (conditional PHIs), manu at gcc dot gnu dot org |
| Indexes: | [Date] [Thread] [Top] [All Lists] |