http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46590
Summary: long compile time with -O2 and many loops Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: tkoe...@gcc.gnu.org The attached program, which is a stress-test to test array assignment dependencies for gfortran, compiles just about forever at -O2; so far, it's 90 minutes and still no sign of finishing. Compilation time without -O2 is 45 seconds. Here is the perl script used to generate the test case. #! /usr/bin/perl $cnt = 0; # @ind = (-6, -3, -1, 1, 3, 6); @ind = (-5, -3, -1, 1, 3, 5); $n = 6; print <<EOF; program main implicit none integer, dimension(-100:100) :: a,b,original integer :: i original = [(15*i+2,i=-100,100)] EOF foreach $stride_l (@ind) { foreach $stride_r (@ind) { for ($start_l = 1; $start_l < $n; $start_l ++) { for ($start_r = 1; $start_r < $n; $start_r ++) { for ($times = 0; $times < $n; $times ++) { $end_l = $start_l + ($times-1)*$stride_l; $end_r = $start_r + ($times-1)*$stride_r; print <<EOF; a = original b = original a($start_l:$end_l:$stride_l) = a($start_r:$end_r:$stride_r) b($start_l:$end_l:$stride_l) = original($start_r:$end_r:$stride_r) if (any (a /= b)) then print *,$start_l, $end_l,$stride_l,$start_r,$end_r, $stride_r call abort end if EOF } } } } } print "end program main\n";