| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-ffrontend-optimize" } |
| 3 |
! PR 66111 - this used to ICE with matmul inlining. |
| 4 |
! Original test case by Mikael Morin. |
| 5 |
|
| 6 |
implicit none |
| 7 |
integer, parameter :: n = 4 |
| 8 |
integer, dimension(n, n) :: a, b, c |
| 9 |
integer, dimension(n*n) :: p, res, res2 |
| 10 |
integer, dimension(n) :: v |
| 11 |
|
| 12 |
integer :: i |
| 13 |
|
| 14 |
p = [ +59, -53, +47, -43, & |
| 15 |
-37, +31, -29, +23, & |
| 16 |
+19, -17, +13, -11, & |
| 17 |
- 7, + 5, - 3, + 2 ] |
| 18 |
a = reshape(p, shape(a)) |
| 19 |
b = reshape([(i, i=1, size(a))], shape(b)) |
| 20 |
v = [ 3, 1, 2, 4] |
| 21 |
c = matmul(a, b) |
| 22 |
res = [ + 14, - 22, + 16, - 22, & |
| 23 |
+150, -158, +128, -138, & |
| 24 |
+286, -294, +240, -254, & |
| 25 |
+422, -430, +352, -370 ] |
| 26 |
!print *,c |
| 27 |
if (any(c /= reshape(res, shape(c)))) STOP 1 |
| 28 |
c(:,v) = matmul(a, b) |
| 29 |
if (any(c(:,v) /= reshape(res, shape(c)))) STOP 2 |
| 30 |
c(v,:) = matmul(a, b) |
| 31 |
if (any(c(v,:) /= reshape(res, shape(c)))) STOP 3 |
| 32 |
|
| 33 |
c = matmul(a(:,v),b(v,:)) |
| 34 |
if (any(c /= reshape(res, shape(c)))) STOP 4 |
| 35 |
end |