This is the mail archive of the gcc-bugs@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]

Re: Optimization bug in C++


> 
> 
> A rewrite of the bug report previously posted as "serious brain damage
> in C++ compiler"
> 
> The C++ compiler does some very dangerous and optimizations. This
> breaks code conformant to the standard CORBA C++ bindings. 
> 
> The problem is the choice of cast operators, exemplified by these messages: 
> 
> SerialServant.cpp:19: warning: choosing `NO::orion::markfeed::Feed_var::operator NO::orion::markfeed::Feed *&()' over `NO::orion::markfeed::Feed_var::operator NO::orion::markfeed::Feed *const &() const'
> SerialServant.cpp:19: warning:   for conversion from `NO::orion::markfeed::Feed_var' to `CORBA_Object *'
> SerialServant.cpp:19: warning:   because conversion sequence for the argument is better
> 
> Explicit casts are used in the code to ensure usage of the right
> conversion. The compiler seems to override these casts, this leads to
> serious memory leaks in corba code.
> 
> Semantics of conversion operators in corba: 
> 
> X_var cast to  X *	 The returned object is owned by the caller.
> X_var cast to const X *	 The returned object is owned by the X_var object.
> 
> Using cast to pointer where cast to pointer to const is intended
> creates memory leaks,
> 
> The SerialServant.ii.bz2 file can be found at:
> http://www.orion.no/SerialServant.ii.bz2

This file is corrupted according to bunzip2 and therefore not of much use.

/Mike


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