PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / dot_product_2.f90
blobd3a037db73a3252d21ad152b81d3979d53171245
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
4 ! PR fortran/57785
6 ! Contributed by Kontantinos Anagnostopoulos
8 ! The implicit complex conjugate was missing for DOT_PRODUCT
11 ! For the following, the compile-time simplification fails for SUM;
12 ! see PR fortran/56342. Hence, a manually expanded SUM is used.
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 ()
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 ()
24 if (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 ()
29 if (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 ()
34 end
37 ! { dg-final { scan-tree-dump-not "abort" "original" } }