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

--- Comment #18 from Rich Townsend <townsend at astro dot wisc.edu> 2011-02-03 
23:04:22 UTC ---
(In reply to comment #8)
> This is a *very* strange bug, to say the least. Here is a reduced test case:
> 
> 
> module hydro_types
>   implicit none
> end module hydro_types
> 
> module hydro_state
>   implicit none
>   type :: state_t
>      real    :: U         
>      integer :: n
>   end type
>   private
>   public :: state_t
> contains
>   subroutine init
>     type(state_t) :: this
>   end subroutine init
> end module hydro_state
> 
> module hydro_speeds
>   use hydro_state
>   implicit none
> contains
>   subroutine speeds_cell (st, c_l, c_r)
>     class(state_t) :: st
>     real     :: c_l(st%n)
>     real     :: c_r(st%n)
>   end subroutine speeds_cell
> end module hydro_speeds
> 
> module hydro_fluxes
>   use hydro_state
>   use hydro_speeds
> end module

Here's an interesting observation: if the definitions of c_l and c_r are
changed to

 real     :: c_l(:)
 real     :: c_r(:)

(i.e., assumed shape rather than explicit shape), then the problem goes away.

In the interests of full disclosure, I should add that this is how I intended
to code the speeds_cell routine in the first place -- I have no real need of
the explicit shapes, assumed shapes are just fine. So, this bug becomes much
less of a showstopper for me.

Reply via email to