https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82009

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
In the tree dump, the declaration for idxs is missing for the first subroutine.
I have modified to the following example so one can see it is not symbol name
conflicts.

MODULE sparse_matrix_csx_benchmark_utils
  IMPLICIT NONE
CONTAINS  
  SUBROUTINE sparse_matrix_csr_benchmark ( )
    WRITE(*,*) 'At*x: t1'
    block
      integer, dimension(1), parameter :: idxs1=[1]
      integer :: i, idx
      do i = 1, size(idxs1)
         idx = idxs1(i)
      enddo
    end block
  END SUBROUTINE sparse_matrix_csr_benchmark
  SUBROUTINE sparse_matrix_csc_benchmark ( )
    WRITE(*,*) 'An*x: t2'
    block
      integer, dimension(1), parameter :: idxs2=[1]
      integer :: i, idx
      do i = 1, size(idxs2)
         idx = idxs2(i)
      enddo
    end block
  END SUBROUTINE sparse_matrix_csc_benchmark
END MODULE sparse_matrix_csx_benchmark_utils

program main
use sparse_matrix_csx_benchmark_utils

call sparse_matrix_csr_benchmark ()
call sparse_matrix_csc_benchmark ()

end program

and the tree dump:

sparse_matrix_csc_benchmark ()
{
  {
    integer(kind=4) i;
    integer(kind=4) idx;

    {
      struct __st_parameter_dt dt_parm.0;

      dt_parm.0.common.filename = &"pr82009.f03"[1]{lb: 1 sz: 1};
      dt_parm.0.common.line = 15;
      dt_parm.0.common.flags = 128;
      dt_parm.0.common.unit = 6;
      _gfortran_st_write (&dt_parm.0);
      _gfortran_transfer_character_write (&dt_parm.0, &"An*x: t2"[1]{lb: 1 sz:
1}, 8);
      _gfortran_st_write_done (&dt_parm.0);
    }
    i = 1;
    while (1)
      {
        {
          logical(kind=4) D.3777;

          D.3777 = i > 1;
          if (D.3777) goto L.3;
          idx = idxs2[(integer(kind=8)) i + -1];
          L.2:;
          i = i + 1;
        }
      }
    L.3:;
    L.1:;
  }
}


sparse_matrix_csr_benchmark ()
{
  {
    static integer(kind=4) idxs2[1] = {1};
    integer(kind=4) i;
    integer(kind=4) idx;

    {
      struct __st_parameter_dt dt_parm.1;

      dt_parm.1.common.filename = &"pr82009.f03"[1]{lb: 1 sz: 1};
      dt_parm.1.common.line = 5;
      dt_parm.1.common.flags = 128;
      dt_parm.1.common.unit = 6;
      _gfortran_st_write (&dt_parm.1);
      _gfortran_transfer_character_write (&dt_parm.1, &"At*x: t1"[1]{lb: 1 sz:
1}, 8);
      _gfortran_st_write_done (&dt_parm.1);
    }
    i = 1;
    while (1)
      {
        {
          logical(kind=4) D.3786;

          D.3786 = i > 1;
          if (D.3786) goto L.6;
          idx = idxs1[(integer(kind=8)) i + -1];
          L.5:;
          i = i + 1;
        }
      }
    L.6:;
    L.4:;
  }
}


MAIN__ ()
{
  sparse_matrix_csr_benchmark ();
  sparse_matrix_csc_benchmark ();
}


__attribute__((externally_visible))
main (integer(kind=4) argc, character(kind=1) * * argv)
{
  static integer(kind=4) options.2[7] = {2116, 4095, 0, 1, 1, 0, 31};

  _gfortran_set_args (argc, argv);
  _gfortran_set_options (7, &options.2[0]);
  MAIN__ ();
  return 0;
}

Reply via email to