User account creation filtered due to spam.

Bug 30575 - Missing warning about unitialized variable (CCP)
Summary: Missing warning about unitialized variable (CCP)
Status: RESOLVED DUPLICATE of bug 18501
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-24 14:37 UTC by Yevgen Muntyan
Modified: 2009-02-07 21:15 UTC (History)
16 users (show)

See Also:
Host:
Target:
Build:
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 Yevgen Muntyan 2007-01-24 14:37:18 UTC
The following code doesn't produce a warning when compiled with gcc-4.1.2. gcc-3.4 does warn about it.

#include <stdio.h>

int func (void)
{
    return 0;
}

int main (void)
{
    int foo;

    if (func ())
        foo = 8;

    printf ("%d\n", foo);
    return 0;
}
Comment 1 Yevgen Muntyan 2007-01-25 13:27:00 UTC
The original code warns if you use -O3 (I guess because of inlining or something), the code below is better:

-------------------------
#include <stdio.h>

int func (void);

int main (void)
{
    int foo;

    if (func ())
        foo = 8;

    printf ("%d\n", foo);
    return 0;
}
-------------------------
Comment 2 Andrew Pinski 2007-01-28 19:29:53 UTC

*** This bug has been marked as a duplicate of 22456 ***
Comment 3 Yevgen Muntyan 2009-02-07 20:35:48 UTC
See the comments #17 and #18 in bug #22456. This is not a dup.
Comment 4 Yevgen Muntyan 2009-02-07 20:38:33 UTC
Hm, it might be a dup of #18501, but a mere mortal like me can't decide if it's so. Sorry for the spam if that's the case.
Comment 5 Manuel López-Ibáñez 2009-02-07 21:15:06 UTC
This is an EXACT duplicate of bug 18501. CCP just assumes that foo is 8 always and just removes foo completely.

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