User account creation filtered due to spam.

Bug 17518 - [4.0 regression] Incorrect <var> is used uninitialized warning (-O1, -O2, -O3)
Summary: [4.0 regression] Incorrect <var> is used uninitialized warning (-O1, -O2, -O3)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks: Wuninitialized
  Show dependency treegraph
 
Reported: 2004-09-16 10:19 UTC by Gerald Pfeifer
Modified: 2005-11-02 19:17 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-09-16 10:37:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Pfeifer 2004-09-16 10:19:16 UTC
% cat x.c
main(int, char **) {
  bool b;
  if( false )
    if( b ) /* this never shall be reached */
      return -1;
}

% gccvs x.c -W -O1
x.c: In function `int main(int, char**)':
x.c:4: warning: 'b' is used uninitialized in this function
Comment 1 Andrew Pinski 2004-09-16 10:22:43 UTC
Hmm, I thought we ran cleanup_cfg before running warn_uninitialized.
Comment 2 Andrew Pinski 2004-09-16 10:37:38 UTC
Hmm, this is a very recent regression
: Search converges between 2004-09-12-trunk (#538) and 2004-09-14-trunk (#539).
Comment 3 Andrew Pinski 2004-10-12 13:10:13 UTC
Fixed by:
        * fold-const.c (fold_build_cleanup_point_expr): New function.
        * tree.h (fold_build_cleanup_point_expr): Prototype.


cp/ChangeLog:
        * semantics.c (maybe_cleanup_point_expr): Call
        fold_build_cleanup_point_expr.
        (maybe_cleanup_point_expr_void): New function.
        (add_decl_expr): Call maybe_cleanup_point_expr_void.
        (finish_expr_stmt): Likewise.
        (finish_return_stmt): Likewise.
        (finish_for_expr): Likewise.
        (finish_asm_stmt): Likewise.
        * typeck.c (condition_conversion): Call
        fold_build_cleanup_point_expr.
        
testsuite/ChangeLog:


        * g++.dg/init/for3.C: New test.
        * g++.dg/opt/switch2.C: New test.
        * g++.dg/warn/Wreturn-2.C: New test.