1! { dg-do compile }
2! { dg-options "-fdump-tree-original" }
3!
4! PR fortran/57785
5!
6! Contributed by Kontantinos Anagnostopoulos
7!
8! The implicit complex conjugate was missing for DOT_PRODUCT
9
10
11! For the following, the compile-time simplification fails for SUM;
12! see PR fortran/56342. Hence, a manually expanded SUM is used.
13
14!if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /))   &
15!   /= SUM (CONJG ((/ (1.0, 2.0), (2.0, 3.0) /))*(/ (1.0, 1.0), (1.0, 4.0) /))) &
16!   call abort ()
17!
18!if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /),                                 &
19!                 RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/))) /=           &
20!         SUM ((/ (1.0, 2.0), (2.0, 3.0) /)*(/ (1.0, 1.0), (1.0, 4.0) /))))     &
21!    call abort ()
22
23
24if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /))  &
25    /= CONJG (cmplx(1.0, 2.0)) * cmplx(1.0, 1.0)                              &
26     + CONJG (cmplx(2.0, 3.0)) * cmplx(1.0, 4.0)) &
27  call abort ()
28
29if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /),                                &
30                 RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/)))             &
31         /= cmplx(1.0, 2.0) * cmplx(1.0, 1.0)                                 &
32          + cmplx(2.0, 3.0) * cmplx(1.0, 4.0)))                               &
33  call abort ()
34end
35
36
37! { dg-final { scan-tree-dump-not "abort" "original" } }
38! { dg-final { cleanup-tree-dump "original" } }
39