flang-compiler/flang

Regression caused by #PR1076

wanbinchen-hnc opened this issue · 3 comments

This test case failed to run, after PR1076 merged into flang.

program test
  type t
    integer :: a(8)
  end type
  type(t) :: stdm1(4, 5), stdm2(5, 4)
  integer, dimension (1:2) :: order1 = (/ 2, 1 /)
  type(t) :: array1(20)
  stdm1 = reshape(array1, (/ 4, 5 /), order = order1)
end
./a.out
Segmentation fault (core dumped)

PR1076 changes type of 'k' to size_t in runtime/flang/bcopys.c, which causes the following loop to become a infinite loop.

for (k = len - 1; k >= 0; k--) {
  to[i + k] = fr[j + k];
}

Thank you for your attention.

@bryanpkc can you fix this? It prevented us from fixing other issues.

I will look, thanks for the reminder.

I have checked #1076 and believe that the other files modified in that PR are correct.