Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 14329
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Andrew Pinski <pinskia@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Falk Hueffner <falk@debian.org>
Add CC:
CC:
Remove selected CCs
Build:
Patch URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 14329 depends on: Show dependency tree
Show dependency graph
Bug 14329 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2006-02-26 19:22 Opened: 2004-02-28 01:08
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'.

------- Comment #1 From Andrew Pinski 2004-02-28 01:12 -------
Confirmed, an enchancement because nothing before this could do this warning.

------- Comment #2 From Andrew Pinski 2004-06-08 19:34 -------
*** Bug 15879 has been marked as a duplicate of this bug. ***

------- Comment #3 From Andrew Pinski 2004-11-01 15:47 -------
*** Bug 18265 has been marked as a duplicate of this bug. ***

------- Comment #4 From Andrew Pinski 2004-12-30 05:08 -------
*** Bug 19196 has been marked as a duplicate of this bug. ***

------- Comment #5 From Andrew Pinski 2005-01-27 01:36 -------
*** Bug 19651 has been marked as a duplicate of this bug. ***

------- Comment #6 From CVS Commits 2005-01-27 09:29 -------
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


------- Comment #7 From Richard Henderson 2005-01-27 09:33 -------
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.

------- Comment #8 From Andrew Pinski 2005-05-02 23:51 -------
*** Bug 21349 has been marked as a duplicate of this bug. ***

------- Comment #9 From Andrew Pinski 2005-09-01 15:59 -------
*** Bug 23679 has been marked as a duplicate of this bug. ***

------- Comment #10 From benoit.hudson@gmail.com 2005-09-01 16:14 -------
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?

------- Comment #11 From Andrew Pinski 2006-08-15 18:31 -------
Any news on this one?

------- Comment #12 From Andrew Pinski 2006-11-21 17:55 -------
*** Bug 29933 has been marked as a duplicate of this bug. ***

------- Comment #13 From Andrew Pinski 2006-11-26 01:44 -------
I am going to test RTH's patch and fix all the fall outs.

------- Comment #14 From Andrew Pinski 2006-11-26 18:25 -------
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.

------- Comment #15 From Andrew Pinski 2006-11-27 05:46 -------
(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.

------- Comment #16 From pinskia@gmail.com 2006-11-27 05:51 -------
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

------- Comment #17 From Andrew Pinski 2006-11-27 06:41 -------
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;

------- Comment #18 From Andrew Pinski 2006-12-04 02:24 -------
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

------- Comment #19 From Andrew Pinski 2006-12-04 18:32 -------
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

------- Comment #20 From Andrew Pinski 2006-12-05 18:05 -------
Fixed.

------- Comment #21 From Andrew Pinski 2006-12-05 18:05 -------
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

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug