public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60444] New: No -Wmaybe-uninitialized warning
@ 2014-03-06 10:01 chengniansun at gmail dot com
  2014-03-13 17:05 ` [Bug tree-optimization/60444] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: chengniansun at gmail dot com @ 2014-03-06 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60444
           Summary: No -Wmaybe-uninitialized warning
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

The auto variable "x" may be uninitialized if "b" is not zero. 

$: cat s.c 
extern void foo();
int test(int b) {
  int x;
  if (b) {
      foo();
  } else {
    x = 1;
  }
  return x;
}
$: gcc-trunk -Wmaybe-uninitialized -c s.c -O3


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

* [Bug tree-optimization/60444] No -Wmaybe-uninitialized warning
  2014-03-06 10:01 [Bug c/60444] New: No -Wmaybe-uninitialized warning chengniansun at gmail dot com
@ 2014-03-13 17:05 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-13 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-13
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c                           |tree-optimization
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The warning will show up with -fno-tree-ccp -fno-tree-vrp.
CCP removes the x = 1; and instead makes the function always return 1, that is
from
    <bb 3>: 
    foo (); 
    goto <bb 5>; 

    <bb 4>: 
    x_7 = 1;

    <bb 5>: 
    # x_1 = PHI <x_6(D)(3), x_7(4)>
    x_8 = x_1;
    return x_8;
it makes
    <bb 3>: 
    foo (); 

    <bb 4>: 
    return 1;


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

end of thread, other threads:[~2014-03-13 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06 10:01 [Bug c/60444] New: No -Wmaybe-uninitialized warning chengniansun at gmail dot com
2014-03-13 17:05 ` [Bug tree-optimization/60444] " mpolacek 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).