GCC 2.95.1 appears to hang on ARM

scottb scottb@netwinder.org
Fri Sep 10 14:40:00 GMT 1999


This problem has been around since egcs 1.1.2.  Phil Blundell, Richard
Earnshaw and myself discussed it quite some time ago (Nov 98), and it
has never been resolved.  So I am reporting it again.

int main(int argc, char **argv)
{
  unsigned long u;
  u = 1;
  u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
  u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
  u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
  u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
  if (!u) _exit (0);
  _exit (1);
}

This code still fails with gcc-2.95.1.  This was reported by me as
hanging.  Phil determined it seems to loop forever in combine.  Richard
Earnshaw investigated and determined compilation is actually
progressing, but 
increasingly slowly.

A synopsis of Richard's analysis: 

The compiler is displaying an O(X^2) behaviour on the length of the
a^=a+a chain (each one taken into consideration takes twice as long as
the previous one).  Given that there are approximately 100 of these 
it's going to take a long time to complete this.  Most ports don't
suffer from the behaviour because the statement above needs two
instructions to execute, but the ARM can do this in one.

Anyone have any ideas?

Scott


More information about the Gcc-bugs mailing list