This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/96: Re: No warning with uninitialised reference...



>Number:         96
>Category:       c++
>Synopsis:       No warning with uninitialised reference...
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 10 15:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     ao@infinet.com
>Release:        2.95.2
>Organization:
>Environment:
>Description:
 Original-Message-Id: <200003102044.PAA16180@shell.oh.voyager.net>
 Date: Fri, 10 Mar 2000 15:44:12 -0500 (EST)

 Hi,

 The following code fails to give a warning about using an uninitialised
 reference. While the code is obviously incorrect, this cost me a lot of
 time trying to debug a crashing server. Please note that I am not at all
 being critical of the work done on gcc, but I would like to note that an
 error such as this is very difficult to track until you actually notice
 the incorrect code...

 Regards,

 /Mike

 ---------------------------------------------------------------------------

 class foo
 {
 public:

   virtual void fn();
 };

 class bar : public foo
 {
 public:

   virtual void fn();
   int fn2();
 };

 int bug_fn(foo& x)
 {
   bar& var = dynamic_cast<bar&>(var);	// <-- the second "var" should be "x"
   return var.fn2();
 };

>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]