aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-07-08 15:48:19 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2013-07-08 15:48:19 +0200
commiteebb98a55b8a102555c0e9823ed5597f8dc7cefb (patch)
tree3f6d6786dfac40f27ff5bcdded308b2f403c82cb /gcc/testsuite/gfortran.dg
parentc8877f40377038ad919467e472ca09625559b1c7 (diff)
downloadgcc-eebb98a55b8a102555c0e9823ed5597f8dc7cefb.zip
gcc-eebb98a55b8a102555c0e9823ed5597f8dc7cefb.tar.gz
gcc-eebb98a55b8a102555c0e9823ed5597f8dc7cefb.tar.bz2
re PR fortran/57785 (DOT_PRODUCT error with constant complex array)
2013-07-08 Tobias Burnus <burnus@net-b.de> PR fortran/57785 * simplify.c (compute_dot_product): Complex conjugate for dot_product. (gfc_simplify_dot_product, gfc_simplify_matmul): Update call. 2013-07-08 Tobias Burnus <burnus@net-b.de> PR fortran/57785 * gfortran.dg/dot_product_2.f90: New. From-SVN: r200786
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/dot_product_2.f9038
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/dot_product_2.f90 b/gcc/testsuite/gfortran.dg/dot_product_2.f90
new file mode 100644
index 0000000..a5fe3b0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dot_product_2.f90
@@ -0,0 +1,38 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/57785
+!
+! Contributed by Kontantinos Anagnostopoulos
+!
+! The implicit complex conjugate was missing for DOT_PRODUCT
+
+
+! For the following, the compile-time simplification fails for SUM;
+! see PR fortran/56342. Hence, a manually expanded SUM is used.
+
+!if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /)) &
+! /= SUM (CONJG ((/ (1.0, 2.0), (2.0, 3.0) /))*(/ (1.0, 1.0), (1.0, 4.0) /))) &
+! call abort ()
+!
+!if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /), &
+! RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/))) /= &
+! SUM ((/ (1.0, 2.0), (2.0, 3.0) /)*(/ (1.0, 1.0), (1.0, 4.0) /)))) &
+! call abort ()
+
+
+if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /)) &
+ /= CONJG (cmplx(1.0, 2.0)) * cmplx(1.0, 1.0) &
+ + CONJG (cmplx(2.0, 3.0)) * cmplx(1.0, 4.0)) &
+ call abort ()
+
+if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /), &
+ RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/))) &
+ /= cmplx(1.0, 2.0) * cmplx(1.0, 1.0) &
+ + cmplx(2.0, 3.0) * cmplx(1.0, 4.0))) &
+ call abort ()
+end
+
+
+! { dg-final { scan-tree-dump-not "abort" "original" } }
+! { dg-final { cleanup-tree-dump "original" } }