This is the mail archive of the gcc@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]
Other format: [Raw text]

help with reporting bug compiling proprietary code


I'm hitting a pretty serious optimisation bug in some proprietary code, and I
don't seem to be able to provide a simple testcase (if I remove a single line of
code, it goes away!). I can't post all the prepossessed source up on gnats for
all the world to see, but I could wrangle allowing certain gcc maintainers
access - what's the procedure in these cases?

FYI, the bug is on powerpc, occurs at O1 and above, was introduced in gcc 3.1
and looks (a bit) like this:


template <class T>
class bla : public base
{
public:
  const Owner * const powner;


  void set(const Owner& owner, T* p) {check_owner(&owner); base::set(p,
*powner);

  void check_owner(const Owner *towner) {
    if (powner != towner)
    {
      if(powner) base::close(*powner);
      else TRAP(bla);
      const_cast<const Owner *&>(powner)=towner;
    }
}

then in a function a call to bla.set() is being inlined and generated as:

<28 = this, 30=p, 31=owner)

mr 4,31
mr 3,28
bl bla<BufferedArray>::check_owner(Owner const*)
mr 4,30
mr 3,28
li 5,0		<<<< VERY VERY VERY wrong!!! should be lwz 5,4(28)
bl base::set_new(ObjectBase*, Owner const &)


funily enough in some situations check_owner is inlined and then the problem
doesn't occur..

Thanks for any help, this is driving me nuts!


Rob Taylor              robt@flyingpig.com
Flying Pig Systems      http://www.flyingpig.com
                        Tel: +44 20 8280 9230


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