public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56574] New: False possibly uninitialized variable warning
@ 2013-03-08 19:10 mark.d.rustad at intel dot com
  2013-03-08 19:25 ` [Bug c/56574] " mark.d.rustad at intel dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: mark.d.rustad at intel dot com @ 2013-03-08 19:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56574

             Bug #: 56574
           Summary: False possibly uninitialized variable warning
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mark.d.rustad@intel.com


The following code produces the warning,'value' may be used uninitialized:

int get_value(void);

void show_problem(int flag)
{
    int value;

    if (!flag)
        value = get_value();

    for (;;) {
        if (!flag && value)
            continue;

        if (!flag)
            break;
    }
}

The warning occurs only with -O1 and -O2 optimization. -O0 and -O3 and higher
do not. It also occurs with many versions. I have gotten the same result with
the following versions of gcc:

i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)

Interestingly, the much larger function that originally displayed the problem
does not generate a warning with the 4.7.0 compiler, but does on the others.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-03-16  8:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-08 19:10 [Bug c/56574] New: False possibly uninitialized variable warning mark.d.rustad at intel dot com
2013-03-08 19:25 ` [Bug c/56574] " mark.d.rustad at intel dot com
2013-03-08 19:51 ` [Bug middle-end/56574] " pinskia at gcc dot gnu.org
2013-03-08 21:11 ` thiago at kde dot org
2013-03-08 21:26 ` pinskia at gcc dot gnu.org
2013-03-11 10:44 ` rguenth at gcc dot gnu.org
2013-03-11 10:45 ` rguenth at gcc dot gnu.org
2014-06-06  1:06 ` luto at mit dot edu
2014-06-06  7:55 ` ebotcazou at gcc dot gnu.org
2014-06-06 12:27 ` manu at gcc dot gnu.org
2021-03-26 15:36 ` [Bug middle-end/56574] False "may be uninitialized variable" warning (&& converted to &) msebor at gcc dot gnu.org
2021-05-04 12:32 ` rguenth at gcc dot gnu.org
2022-03-16  8:36 ` [Bug tree-optimization/56574] " coenraad at wish dot org.za
2022-03-16  8:39 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).