public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables
@ 2004-06-29 16:35 bangerth at dealii dot org
  2004-06-29 16:43 ` [Bug tree-optimization/16277] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-06-29 16:35 UTC (permalink / raw)
  To: gcc-bugs

There is certainly nothing uninitialized in this code (unless 
possibly in std::vector<bool>, which I haven't checked yet): 
----------------------------- 
#include <vector> 
 
struct D { 
    D (const std::vector<bool> &); 
    const std::vector<bool> a; 
}; 
 
D::D (const std::vector<bool> &v) 
                : 
                a (v.size() == 0 ? std::vector<bool> () : v) 
{} 
----------------------- 
 
Yet I get this: 
parameter-estimation/libparest> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -O2 
-Wuninitialized -c x.cc 
x.cc: In constructor `D::D(const std::vector<bool, std::allocator<bool> >&)': 
x.cc:11: warning: 'this.350' is used uninitialized in this function 
x.cc: In constructor `D::D(const std::vector<bool, std::allocator<bool> >&)': 
x.cc:11: warning: 'this.350' is used uninitialized in this function 
 
Note also that the warning is indeed printed twice. 
 
W.

-- 
           Summary: [3.5 regression] Still spurious warnings about unused
                    SSA variables
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
@ 2004-06-29 16:43 ` pinskia at gcc dot gnu dot org
  2004-06-29 16:45 ` bangerth at dealii dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-29 16:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-29 16:42 -------
One this is not a SSA variable, this is just a split variable from this.

And the reason why this is printed twice is again because of the ABI and in/out of charge constructors 
(and cloning).

-- 


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


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

* [Bug tree-optimization/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
  2004-06-29 16:43 ` [Bug tree-optimization/16277] " pinskia at gcc dot gnu dot org
@ 2004-06-29 16:45 ` bangerth at dealii dot org
  2004-06-29 16:58 ` [Bug c++/16277] " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-06-29 16:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-29 16:43 -------
That was actually simpler than thought:  
------------------  
struct X {  
    X ();  
    ~X ();  
    unsigned size() const;  
};  
  
struct D {  
    D (const X &);  
    const X a;  
};  
  
D::D (const X &v)  
                :  
                a (v.size() == 0 ? X () : v)  
{}  
--------------------  
parameter-estimation/libparest> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -O2  
-Wuninitialized -c x.cc  
x.cc: In constructor `D::D(const X&)':  
x.cc:15: warning: 'this.1' is used uninitialized in this function  
x.cc: In constructor `D::D(const X&)':  
x.cc:15: warning: 'this.1' is used uninitialized in this function  
  
There is indeed nothing uninitialized in the code, it's a compiler bug.  
  
W.  
  

-- 


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


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

* [Bug c++/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
  2004-06-29 16:43 ` [Bug tree-optimization/16277] " pinskia at gcc dot gnu dot org
  2004-06-29 16:45 ` bangerth at dealii dot org
@ 2004-06-29 16:58 ` pinskia at gcc dot gnu dot org
  2004-06-30  2:55 ` giovannibajo at libero dot it
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-29 16:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-29 16:51 -------
Looking at the tree Dumps, this looks like a bug in the C++ front-end rather than the optimizations:
>From *.original:
  T.0 = size (v);
  if (T.0 == 0)
    { 
      this.1 = (struct X *)this;
      __comp_ctor (this.1);
    }
  else
    { 
      *this.1 = *v;
    }
  try
    {

    }
  catch
    { 
      this.2 = (struct X *)this;
      __comp_dtor (this.2);
    }

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |c++
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic, wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-29 16:51:28
               date|                            |
   Target Milestone|---                         |3.5.0


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


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

* [Bug c++/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2004-06-29 16:58 ` [Bug c++/16277] " pinskia at gcc dot gnu dot org
@ 2004-06-30  2:55 ` giovannibajo at libero dot it
  2004-06-30 21:44 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-30  2:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-30 02:50 -------
Sorry? this.1 is initialized using this, which is a parm.

-- 


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


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

* [Bug c++/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2004-06-30  2:55 ` giovannibajo at libero dot it
@ 2004-06-30 21:44 ` pinskia at gcc dot gnu dot org
  2004-06-30 22:17 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-30 21:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-30 21:41 -------
Look at the tree dump I gave again, this.1 is stored to in the false case but only set in the true case.

-- 


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


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

* [Bug c++/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (4 preceding siblings ...)
  2004-06-30 21:44 ` pinskia at gcc dot gnu dot org
@ 2004-06-30 22:17 ` bangerth at dealii dot org
  2004-07-15 18:55 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-06-30 22:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-30 22:12 -------
I had to think about the same question as Giovanni. In short: in the else-branch, 
we just have 
    {  
      *this.1 = *v; 
    } 
i.e. we write into *this.1 (the address pointed to) without initializing this.1 (the pointer). 
We're fine in the if-branch, where we initialize this.1 first. 
 
W. 

-- 


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


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

* [Bug c++/16277] [3.5 regression] Still spurious warnings about unused SSA variables
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (5 preceding siblings ...)
  2004-06-30 22:17 ` bangerth at dealii dot org
@ 2004-07-15 18:55 ` pinskia at gcc dot gnu dot org
  2004-07-15 19:04 ` [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers bangerth at dealii dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-15 18:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-15 18:55 -------
*** Bug 16568 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snyder at fnal dot gov


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


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

* [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (6 preceding siblings ...)
  2004-07-15 18:55 ` pinskia at gcc dot gnu dot org
@ 2004-07-15 19:04 ` bangerth at dealii dot org
  2004-07-22  4:58 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-07-15 19:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-15 19:04 -------
PR 16585 has an example where this actually leads to wrong code. 
Fixing this bug is critical. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.5 regression] Still      |[3.5 regression] Wrong code
                   |spurious warnings about     |with conditionals in
                   |unused SSA variables        |initializers


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


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

* [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (7 preceding siblings ...)
  2004-07-15 19:04 ` [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers bangerth at dealii dot org
@ 2004-07-22  4:58 ` pinskia at gcc dot gnu dot org
  2004-07-22 23:15 ` rth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22  4:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-22 04:58 -------
Using Phil's regression hunter a little I found these are the dates when it was introduced:
469 (2004-06-20) - 470 (2004-06-22)

I almost think it is this patch:
2004-06-20  Richard Henderson  <rth@redhat.com>

        * cp-tree.def (CLEANUP_STMT, IF_STMT): Move from c-common.def.
        * cp-gimplify.c (gimplify_if_stmt): Move from c-gimplify.c.
        (cp_gimplify_expr): Call it.
        (gimplify_cleanup_stmt): Move from c-gimplify.c.
        (cp_genericize): New.
        * decl.c (finish_function): Call it.
        * cp-tree.h (cp_stmt_codes): Add CLEANUP_STMT, IF_STMT.
        (CLEANUP_BODY, CLEANUP_EXPR, CLEANUP_DECL): Move from c-common.h.
        (IF_COND, THEN_CLAUSE, ELSE_CLAUSE): Likewise.
        (cp_genericize): Declare.
        * cxx-pretty-print.c (pp_cxx_statement): Add CLEANUP_STMT, IF_STMT.
        * dump.c (cp_dump_tree): Likewise.
        * semantics.c (push_cleanup): Move from c-semantics.c.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


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


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

* [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (8 preceding siblings ...)
  2004-07-22  4:58 ` pinskia at gcc dot gnu dot org
@ 2004-07-22 23:15 ` rth at gcc dot gnu dot org
  2004-07-23 22:48 ` cvs-commit at gcc dot gnu dot org
  2004-07-23 22:55 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-07-22 23:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-07-22 23:15 -------
That patch isn't the culprit, but I'm fixing it anyway.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (9 preceding siblings ...)
  2004-07-22 23:15 ` rth at gcc dot gnu dot org
@ 2004-07-23 22:48 ` cvs-commit at gcc dot gnu dot org
  2004-07-23 22:55 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-23 22:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-23 22:48 -------
Subject: Bug 16277

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-07-23 22:48:15

Modified files:
	gcc            : ChangeLog gimplify.c 

Log message:
	PR c++/16277
	* gimplify.c (gimplify_cond_expr): Gimplify TARGET to a min_lval;
	unshare it properly.
	(gimplify_modify_expr_rhs): Push assignment from a conditional into
	the conditional for all non-register types.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4654&r2=2.4655
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.52&r2=2.53



-- 


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


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

* [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers
  2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
                   ` (10 preceding siblings ...)
  2004-07-23 22:48 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-23 22:55 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-07-23 22:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-07-23 22:55 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-07-23 22:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-29 16:35 [Bug tree-optimization/16277] New: [3.5 regression] Still spurious warnings about unused SSA variables bangerth at dealii dot org
2004-06-29 16:43 ` [Bug tree-optimization/16277] " pinskia at gcc dot gnu dot org
2004-06-29 16:45 ` bangerth at dealii dot org
2004-06-29 16:58 ` [Bug c++/16277] " pinskia at gcc dot gnu dot org
2004-06-30  2:55 ` giovannibajo at libero dot it
2004-06-30 21:44 ` pinskia at gcc dot gnu dot org
2004-06-30 22:17 ` bangerth at dealii dot org
2004-07-15 18:55 ` pinskia at gcc dot gnu dot org
2004-07-15 19:04 ` [Bug c++/16277] [3.5 regression] Wrong code with conditionals in initializers bangerth at dealii dot org
2004-07-22  4:58 ` pinskia at gcc dot gnu dot org
2004-07-22 23:15 ` rth at gcc dot gnu dot org
2004-07-23 22:48 ` cvs-commit at gcc dot gnu dot org
2004-07-23 22:55 ` rth at gcc dot gnu dot 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).