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]
Other format: [Raw text]

[Bug tree-optimization/18040] [4.0 Regression] ICE in for_each_index, at tree-ssa-loop-im.c:178


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-17 22:17 -------
The front-end is doing something funny for this example where there should be no cast, it is still 
creating a "void (object_base::*)() const" type.
int PyObject_IsTrue();
struct object_base
{
    void ptr() const;
};
struct object : public object_base
{
  typedef void (object::*bool_type)() const;
  inline operator bool_type() const { return PyObject_IsTrue() ? &object::ptr : 0; }
};
void f();
void g (void)
{
    for (unsigned n = 0; n < 100; ++n)
    {
        object kv;
        if (kv)
          f();
    }
}

If I add a cast such as:
  inline operator bool_type() const { return PyObject_IsTrue() ? (bool_type) &object::ptr : 0; }
It works and we only produce bool_type instead of what we produced before so part of this is front-end 
issue and a tree-opt issue also for the case I gave in comment #9.

-- 


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


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