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 c++/49073] g++ optimizer breaks do-while code


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.20 06:57:01
                 CC|                            |jakub at gcc dot gnu.org
            Version|4.5.2                       |4.6.0
     Ever Confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-20 06:57:01 UTC ---
Confirmed for 4.6 and trunk, if you can reproduce it with 4.5, complain to
Ubuntu for backporting very risky patch that caused already more than one
regression.

Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160445

Simplified testcase:
extern void abort (void);
int c;

int
main ()
{
  int a[] = { 1, 2, 3, 4, 5, 6, 7 }, d = 1, i = 1;
  _Bool f = 0;
  do
    {
      d = a[i];
      if (f && d == 4)
        {
          ++c;
          break;
        }
      i++;
      f = (d == 3);
    }
  while (d < 7);
  if (c != 1)
    abort ();
  return 0;
}

I'll have a look.


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