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 target/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-15 12:29:51 UTC ---
Perhaps even for:
void bar (void);
int test (int);

int fn (int x, int y)
{
  int i;
  for (i = 0; i < y && test (i); i++)
    ;
  if (i == y)
    return;
  if (i == __INT_MAX__)
    bar ();
}

we should be able to determine that bar can't be called.  In the loop body
i is known to be i < y, after the loop i <= y but the i == y test rules out the
equality again, so we end up again with i < y which is certainly i <
__INT_MAX__.


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