This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
gcc version 3.5-tree-ssa 20040217 (merged 20040211) int sys_msgctl (void) { struct { int mode; } setbuf; return setbuf.mode; } % gcc -O2 -Wall -c gcc_bug.c gcc_bug.c: In function `sys_msgctl': gcc_bug.c:4: warning: 'setbuf$mode' is used uninitialized in this function Very cool of SRA to recognize this, but it should really say 'setbuf.mode'.
Confirmed, an enchancement because nothing before this could do this warning.
*** Bug 15879 has been marked as a duplicate of this bug. ***
*** Bug 18265 has been marked as a duplicate of this bug. ***
*** Bug 19196 has been marked as a duplicate of this bug. ***
*** Bug 19651 has been marked as a duplicate of this bug. ***
Subject: Bug 14329 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-01-27 09:28:46 Modified files: gcc : ChangeLog c-objc-common.c dwarf2out.c toplev.c tree-outof-ssa.c tree-sra.c tree.h var-tracking.c Added files: gcc/testsuite/gcc.dg: uninit-I.c Log message: PR tree-opt/14329 * tree.h (struct tree_decl): Add debug_expr_is_from. (DECL_DEBUG_EXPR_IS_FROM): New. (DECL_DEBUG_EXPR): Rename from DECL_DEBUG_ALIAS_OF. * dwarf2out.c (dwarf2out_var_location): Update to match. * tree-outof-ssa.c (create_temp): Likewise. * var-tracking.c (track_expr_p): Likewise. * tree-sra.c (instantiate_element): Set DECL_DEBUG_EXPR. * c-objc-common.c (c_tree_printer) <'D'>: Handle DECL_DEBUG_EXPR. * toplev.c (default_tree_printer): Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7302&r2=2.7303 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-objc-common.c.diff?cvsroot=gcc&r1=1.60&r2=1.61 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.568&r2=1.569 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.940&r2=1.941 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-outof-ssa.c.diff?cvsroot=gcc&r1=2.42&r2=2.43 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-sra.c.diff?cvsroot=gcc&r1=2.50&r2=2.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.682&r2=1.683 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/var-tracking.c.diff?cvsroot=gcc&r1=2.25&r2=2.26 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/uninit-I.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
C++ front end left to update. See http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01988.html for an example of something that almost but does not quite work.
*** Bug 21349 has been marked as a duplicate of this bug. ***
*** Bug 23679 has been marked as a duplicate of this bug. ***
With this number of duplicates, perhaps it's time to change the title to contain "used uninitialized" so searchers are more likely to find it?
Any news on this one?
*** Bug 29933 has been marked as a duplicate of this bug. ***
I am going to test RTH's patch and fix all the fall outs.
The problem with RTH's patch was the use of t which shadowed the variable in the function which is used for setting the locus. I am testing the corrected patch now.
(In reply to comment #14) > The problem with RTH's patch was the use of t which shadowed the variable in > the function which is used for setting the locus. I am testing the corrected > patch now. That fixed most of the failures but there are still some ICEs that need to be fixed.
Subject: Re: [tree-ssa] badly formatted warnings for SRA replacements used uninitialized On Mon, 2006-11-27 at 05:46 +0000, pinskia at gcc dot gnu dot org wrote: > That fixed most of the failures but there are still some ICEs that need to be > fixed. I have a fix for those ICEs, it is just checking for DECL_P. -- Pinski
Here is the patch which passes the C++ testsuite, I have to do a full bootstrap/testsuite run still but I am happy with it currrently which is why I am pasting it here: Index: error.c =================================================================== --- error.c (revision 119217) +++ error.c (working copy) @@ -2337,7 +2337,22 @@ cp_printer (pretty_printer *pp, text_inf { case 'A': result = args_to_string (next_tree, verbose); break; case 'C': result = code_to_string (next_tcode); break; - case 'D': result = decl_to_string (next_tree, verbose); break; + case 'D': + { + tree temp = next_tree; + if (DECL_P (temp) + && DECL_DEBUG_EXPR_IS_FROM (temp) && DECL_DEBUG_EXPR (temp)) + { + temp = DECL_DEBUG_EXPR (temp); + if (!DECL_P (temp)) + { + result = expr_to_string (temp); + break; + } + } + result = decl_to_string (temp, verbose); + } + break; case 'E': result = expr_to_string (next_tree); break; case 'F': result = fndecl_to_string (next_tree, verbose); break; case 'L': result = language_to_string (next_lang); break;
Subject: Bug 14329 Author: pinskia Date: Mon Dec 4 02:24:42 2006 New Revision: 119478 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119478 Log: 2006-12-03 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * error.c (cp_printer) <'D'>: Handle DECL_DEBUG_EXPR. 2006-12-03 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * g++.dg/warn/unit-1.C: New test. Added: trunk/gcc/testsuite/g++.dg/warn/unit-1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/error.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 14329 Author: pinskia Date: Mon Dec 4 18:31:40 2006 New Revision: 119501 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119501 Log: 2006-12-04 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * error.c (cp_printer) <'D'>: Handle DECL_DEBUG_EXPR. 2006-12-04 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * g++.dg/warn/unit-1.C: New test. Added: branches/gcc-4_2-branch/gcc/testsuite/g++.dg/warn/unit-1.C - copied unchanged from r119478, trunk/gcc/testsuite/g++.dg/warn/unit-1.C Modified: branches/gcc-4_2-branch/gcc/cp/ChangeLog branches/gcc-4_2-branch/gcc/cp/error.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Fixed.
Subject: Bug 14329 Author: pinskia Date: Tue Dec 5 18:04:44 2006 New Revision: 119548 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119548 Log: 2006-12-05 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * error.c (cp_printer) <'D'>: Handle DECL_DEBUG_EXPR. 2006-12-05 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * g++.dg/warn/unit-1.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/warn/unit-1.C - copied unchanged from r119478, trunk/gcc/testsuite/g++.dg/warn/unit-1.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/error.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog