------- Comment #1 from rguenth at gcc dot gnu dot org  2006-04-11 08:28 -------
Confirmed.  The following aborts with -O2 and works with -O, optimized tree
dumps are identical.

extern "C" void abort(void);
struct Test { char *p; };
inline void align(char* &p)
{
    ((long &)p) += 3;
    ((long &)p) &= -4;
}
int main()
{
    char buffer[8] = {0};
    Test t = { buffer };
    align(t.p);
    t.p += 4;
    align(t.p);
    t.p += 4;
    if (t.p - buffer != 8)
        abort();
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |rtl-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to work|                            |4.0.3
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-11 08:28:33
               date|                            |
            Summary|inlining bug under          |[4.1/4.2 Regression] Bug
                   |optimization. (cast to      |under optimization. (cast to
                   |reference)                  |reference)
   Target Milestone|---                         |4.1.1


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

Reply via email to