This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization bug in C++
- To: knut at orion dot no (Knut-Håvard Aksnes)
- Subject: Re: Optimization bug in C++
- From: Mike Harrold <mharrold at cas dot org>
- Date: Thu, 26 Aug 1999 08:57:50 -0400 (EDT)
- Cc: gcc-bugs at gcc dot gnu dot org
>
>
> 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