Debian Codegraph @

gcc/testsuite/gfortran.dg/dot_product_2.f90

raw
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 ! STOP 1
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 ! STOP 2
22
23
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 STOP 3
28
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 STOP 4
34 end
35
36
37 ! { dg-final { scan-tree-dump-not "_gfortran_stop" "original" } }