re PR fortran/54656 (ICE with software REAL(16) for NORM2)
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 16 Aug 2015 19:47:02 +0000 (19:47 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 16 Aug 2015 19:47:02 +0000 (19:47 +0000)
PR fortran/54656

* trans-intrinsic.c (gfc_build_intrinsic_lib_fndecls): Add decl
for quadruple precision BUILT_IN_SQRT.

* gfortran.dg/norm_4.f90: Rename to...
* gfortran.dg/norm2_4.f90: this.
* gfortran.dg/norm2_5.f90: New test.

From-SVN: r226929

gcc/fortran/ChangeLog
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/norm2_4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/norm2_5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/norm_4.f90 [deleted file]

index 4a58499de54a2198a27ca5ed69b261029c760bb9..3a6387517478b226d9b8397235b888546fdb8fdc 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/54656
+       * trans-intrinsic.c (gfc_build_intrinsic_lib_fndecls): Add decl
+       for quadruple precision BUILT_IN_SQRT.
+
 2015-08-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * trans-intrinsic.c (conv_intrinsic_ieee_is_negative): Use type
index 60e18b8eaf56e55d910fa72f80efe3be00926187..f5b270f4bf75414af1a03347f6452dc8acc8d51f 100644 (file)
@@ -676,6 +676,11 @@ gfc_build_intrinsic_lib_fndecls (void)
 #undef DEFINE_MATH_BUILTIN
 #undef DEFINE_MATH_BUILTIN_C
 
+    /* There is one built-in we defined manually, because it gets called
+       with builtin_decl_for_precision() or builtin_decl_for_float_type()
+       even though it is not an OTHER_BUILTIN: it is SQRT.  */
+    quad_decls[BUILT_IN_SQRT] = define_quad_builtin ("sqrtq", func_1, true);
+
   }
 
   /* Add GCC builtin functions.  */
index 221a0ab257ef23b7fa17ee66d3074f34d9e4d437..28a231cc93540e015088f6fea50f35a01cab5552 100644 (file)
@@ -1,3 +1,10 @@
+2015-08-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/54656
+       * gfortran.dg/norm_4.f90: Rename to...
+       * gfortran.dg/norm2_4.f90: this.
+       * gfortran.dg/norm2_5.f90: New test.
+
 2015-08-14  Alexandre Oliva <aoliva@redhat.com>
 
        * gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars.
diff --git a/gcc/testsuite/gfortran.dg/norm2_4.f90 b/gcc/testsuite/gfortran.dg/norm2_4.f90
new file mode 100644 (file)
index 0000000..276b174
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/33197
+!
+! Check implementation of L2 norm (Euclidean vector norm)
+!
+implicit none
+
+print *, norm2([1.0, 2.0]) ! { dg-error "has no IMPLICIT type" }
+end
diff --git a/gcc/testsuite/gfortran.dg/norm2_5.f90 b/gcc/testsuite/gfortran.dg/norm2_5.f90
new file mode 100644 (file)
index 0000000..0416fd6
--- /dev/null
@@ -0,0 +1,23 @@
+! { dg-do compile }
+!
+! Testcase from PR 54656
+! Checking for NORM2 for large float kinds
+!
+program test
+  implicit none
+
+  ! k1 and k2 will be large real kinds, if supported, and single/double
+  ! otherwise
+  integer, parameter :: k1 = &
+    max(selected_real_kind(precision(0.d0) + 1), kind(0.))
+  integer, parameter :: k2 = &
+    max(selected_real_kind(precision(0._k1) + 1), kind(0.d0))
+
+  real(kind=k1) :: d1(10), z1
+  real(kind=k2) :: d2(10), z2
+  d1 = 1 ; d2 = 1
+  z1 = norm2 (d1)
+  z2 = norm2 (d2)
+
+  print *, z1, z2
+end program test
diff --git a/gcc/testsuite/gfortran.dg/norm_4.f90 b/gcc/testsuite/gfortran.dg/norm_4.f90
deleted file mode 100644 (file)
index 276b174..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-! { dg-do compile }
-! { dg-options "-std=f2003" }
-!
-! PR fortran/33197
-!
-! Check implementation of L2 norm (Euclidean vector norm)
-!
-implicit none
-
-print *, norm2([1.0, 2.0]) ! { dg-error "has no IMPLICIT type" }
-end