public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34196]  New: [4.3 Regression] uninitialized variable warning in dead exception region
@ 2007-11-22 16:18 rguenth at gcc dot gnu dot org
  2007-11-25  2:49 ` [Bug c++/34196] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-22 16:18 UTC (permalink / raw)
  To: gcc-bugs

#include <string>

template <class _Tp> class AutoPtr {
  _Tp* _M_ptr;

public:
  explicit AutoPtr(_Tp* __p = 0)  : _M_ptr(__p) {}

  ~AutoPtr() { delete _M_ptr; }

  _Tp* operator->() const  {
    return _M_ptr;
  }
};

struct A {
    virtual ~A();
    virtual A * unserialise(const std::string &s) const = 0;
};

A * wtx;

void
func(const std::string & s)
{
    AutoPtr<A> wt(wtx->unserialise(s.c_str()));
}


g++ -O -Wuninitialized -c remoteserver.cc
remoteserver.cc: In function 'void func(const std::string&)':
remoteserver.cc:9: warning: 'wt.AutoPtr<A>::_M_ptr' is used uninitialized in
this function
remoteserver.cc:26: note: 'wt.AutoPtr<A>::_M_ptr' was declared here


because in the late uninitalized variable pass we discover

<L1>:;
  save_filt.37_16 = <<<filter object>>>;
  save_eptr.36_17 = <<<exception object>>>;
  if (wt$_M_ptr_40(D) != 0B)
    goto <bb 12>;
  else
    goto <bb 13>;

<bb 12>:
  D.13202_23 = wt$_M_ptr_40(D)->_vptr.A;
  D.13203_24 = D.13202_23 + 8;
  D.13204_25 = *D.13203_24;
  OBJ_TYPE_REF(D.13204_25;wt$_M_ptr_40(D)->1) (wt$_M_ptr_40(D));

which hasn't been deleted here.  4.2 was either able to delete these BBs
or didn't create this exception region.


-- 
           Summary: [4.3 Regression] uninitialized variable warning in dead
                    exception region
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
@ 2007-11-25  2:49 ` pinskia at gcc dot gnu dot org
  2007-11-27  5:48 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-25  2:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.3.0


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
  2007-11-25  2:49 ` [Bug c++/34196] " pinskia at gcc dot gnu dot org
@ 2007-11-27  5:48 ` mmitchel at gcc dot gnu dot org
  2007-12-03  3:33 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-27  5:48 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
  2007-11-25  2:49 ` [Bug c++/34196] " pinskia at gcc dot gnu dot org
  2007-11-27  5:48 ` mmitchel at gcc dot gnu dot org
@ 2007-12-03  3:33 ` pinskia at gcc dot gnu dot org
  2007-12-03 14:52 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-03  3:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-12-03 03:33 -------
This looks like a front-end/gimplifier bug.

So we have:
allocator::allocator();
try {
  char* a = s->c_str();
  t = string::string(a);
  try {
   b =  wtx-> unserialise (t);
   wt = AutoPtr::AutoPtr (b);
  } finnally {
    try {
      string::~string(t);
      } catch
      {
        AutoPtr::~AutoPtr (wt);
      }
  }
}
...


At the time we call ~AutoPtr, it does not have to be fully constructored.

I think this is related (and maybe even caused by) PR 15764.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-03 03:33:45
               date|                            |


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-12-03  3:33 ` pinskia at gcc dot gnu dot org
@ 2007-12-03 14:52 ` jason at gcc dot gnu dot org
  2008-01-14 17:09 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-12-03 14:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-03 03:33:45         |2007-12-03 14:52:41
               date|                            |


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-12-03 14:52 ` jason at gcc dot gnu dot org
@ 2008-01-14 17:09 ` jason at gcc dot gnu dot org
  2008-01-16 22:39 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-14 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jason at gcc dot gnu dot org  2008-01-14 16:15 -------
This is indeed caused by the patch for 15764.  If unserialize throws, and then
the destructor for the string temporary passed as the argument to unserialize
throws, we would then destroy wt without having constructed it.  Except that we
should call terminate() if the string destructor throws, because we were
unwinding the stack.


-- 


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-01-14 17:09 ` jason at gcc dot gnu dot org
@ 2008-01-16 22:39 ` rguenth at gcc dot gnu dot org
  2008-01-22  5:28 ` jason at gcc dot gnu dot org
  2008-01-22 13:33 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-16 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-01-16 22:29 -------
*** Bug 34470 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zackw at panix dot com


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-01-16 22:39 ` rguenth at gcc dot gnu dot org
@ 2008-01-22  5:28 ` jason at gcc dot gnu dot org
  2008-01-22 13:33 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-22  5:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2008-01-22 04:54 -------
Subject: Bug 34196

Author: jason
Date: Tue Jan 22 04:53:33 2008
New Revision: 131710

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131710
Log:
        PR c++/34196
        * tree.h (TRY_CATCH_IS_CLEANUP): New macro.
        * cp/decl.c (wrap_cleanups_r): Set TRY_CATCH_IS_CLEANUP.
        * tree-eh.c (honor_protect_cleanup_actions): Strip TRY_CATCH_EXPR
        if it is set.

Added:
    trunk/gcc/testsuite/g++.dg/eh/init-temp2.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/tree-eh.c
    trunk/gcc/tree.h


-- 


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


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

* [Bug c++/34196] [4.3 Regression] uninitialized variable warning in dead exception region
  2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-01-22  5:28 ` jason at gcc dot gnu dot org
@ 2008-01-22 13:33 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-22 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-01-22 13:24 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-01-22 13:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 16:18 [Bug c++/34196] New: [4.3 Regression] uninitialized variable warning in dead exception region rguenth at gcc dot gnu dot org
2007-11-25  2:49 ` [Bug c++/34196] " pinskia at gcc dot gnu dot org
2007-11-27  5:48 ` mmitchel at gcc dot gnu dot org
2007-12-03  3:33 ` pinskia at gcc dot gnu dot org
2007-12-03 14:52 ` jason at gcc dot gnu dot org
2008-01-14 17:09 ` jason at gcc dot gnu dot org
2008-01-16 22:39 ` rguenth at gcc dot gnu dot org
2008-01-22  5:28 ` jason at gcc dot gnu dot org
2008-01-22 13:33 ` rguenth 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).