------- Comment #12 from jjcogliati-r1 at yahoo dot com  2010-01-12 21:14 
-------
(In reply to comment #10)
> Subject: Re:  Internal compiler exception in with gfortran
>  when using  -fwhole-program -flto -fopenmp
> 
> On Mon, 11 Jan 2010, jjcogliati-r1 at yahoo dot com wrote:
> 
> > 
> > 
> > ------- Comment #9 from jjcogliati-r1 at yahoo dot com  2010-01-11 17:15 
> > -------
> > My hunch, (and I could be wrong since my knowledge of gcc's tree code was 
> > zero
> > as of Friday morning) is that it is trying to find the array's min and max
> > size, but that only the min location is available, and that the max value is
> > undefined.  Since this is fortran code, there are a number of places that I 
> > do
> > that.  Is that plausible, and if so, how would I check this hunch?
> 
> It should never be error_mark_node ...
> 
> > Getting permission for me to get you the full code would involve a lot of
> > bureaucracy (weeks to months).  
> 
> Oh, I see ...
> 
> You could try putting an assert in 
> lto-streamer-out.c:lto_output_ts_type_tree_pointers so that
> the TYPE_MIN/MAXVAL are not error_mark_node.
> 
> That would point you to the file and function.
> 
> Richard.
> 

That did the trick.  Thank you.  

Added lto-streamer-out.c:lto_output_ts_type_tree_pointers:
  else if (TREE_CODE (expr) == ARRAY_TYPE) {
+    gcc_assert(TYPE_MAX_VALUE (TYPE_DOMAIN (expr) ) == NULL || 
+              TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (expr) )) != ERROR_MARK
);
    lto_output_tree_or_ref (ob, TYPE_DOMAIN (expr), ref_p);
  }


I can now trigger the original ice with the following valid (I think) code:
!list_use.f90
program list_use
  use list_test
  implicit none

  integer, dimension(10) :: a_list

  a_list = 1
  call loop_list(a_list)
end program list_use

!list_test.f90
module list_test
  !$ use omp_lib
  implicit none

contains

  subroutine loop_list(list)
    integer, intent(in), dimension(:) :: list
    integer :: ii
    !$ integer :: chunk_size
    !$ chunk_size = 4
    !$OMP PARALLEL DO SCHEDULE(dynamic,chunk_size)
    do ii=1,size(list)
       call do_things(list, ii)
    end do

  end subroutine loop_list

  subroutine do_things(list, index)
    integer, intent(in),dimension(:) :: list
    integer, intent(in) :: index
    print *,size(list),index
  end subroutine do_things

end module list_test



$ ~/gcc/old4_gcc45/bin/gfortran -Wall -o list_use -fopenmp -fwhole-program
-flto  list_test.f90 list_use.f90
lto1: internal compiler error: in iterative_hash_expr, at tree.c:6592
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: /home/jjc/gcc/old4_gcc45/bin/gfortran returned 1 exit status
collect2: lto-wrapper returned 1 exit status


-- 


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

Reply via email to