Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 226928)
+++ gcc/fortran/ChangeLog	(working copy)
@@ -1,5 +1,11 @@
 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
 	generic BUILT_IN_SIGNBIT.
 	(conv_intrinsic_ieee_copy_sign): Likewise.
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(revision 226924)
+++ gcc/fortran/trans-intrinsic.c	(working copy)
@@ -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: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 226928)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -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.
Index: gcc/testsuite/gfortran.dg/norm2_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/norm2_5.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/norm2_5.f90	(working copy)
@@ -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
Index: gcc/testsuite/gfortran.dg/norm_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/norm_4.f90	(revision 226894)
+++ gcc/testsuite/gfortran.dg/norm_4.f90	(working copy)
@@ -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
