Index: gcc/DATESTAMP
===================================================================
--- gcc/DATESTAMP	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/DATESTAMP	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1 +1 @@
-20150422
+20150423
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/ChangeLog	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1,3 +1,20 @@
+2015-04-22  Georg-Johann Lay  <avr@gjlay.de>
+
+	Backport from trunk r222179.
+
+	2015-04-17  Sivanupandi Pitchumani <Pitchumani.Sivanupandi@atmel.com>
+
+	PR target/65296
+	* config/avr/gen-avr-mmcu-specs.c (*avrlibc_startfile): Adjust
+	to new AVR-LibC file layout (bug #44574).
+	(*avrlibc_devicelib): Same.
+	* config/avr/avr-mcus.def: Adjust comments.
+	* config/avr/avr.opt (nodevicelib): Adjust help.
+
+2015-04-22  Jakub Jelinek  <jakub@redhat.com>
+
+	* BASE-VER: Set to 5.1.1.
+
 2015-04-22  Release Manager
 
 	* GCC 5.1.0 released.
Index: gcc/testsuite/gcc.target/i386/avx512dq-vfpclasspd-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512dq-vfpclasspd-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512dq-vfpclasspd-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,7 +6,8 @@
 #include "avx512f-helper.h"
 
 #include <math.h>
-#include <values.h>
+#include <limits.h>
+#include <float.h>
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 
Index: gcc/testsuite/gcc.target/i386/avx512bw-vpmaddwd-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512bw-vpmaddwd-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512bw-vpmaddwd-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,7 +6,8 @@
 #include "avx512f-helper.h"
 
 #include <math.h>
-#include <values.h>
+#include <limits.h>
+#include <float.h>
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 
Index: gcc/testsuite/gcc.target/i386/avx512bw-vpermi2w-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512bw-vpermi2w-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512bw-vpermi2w-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,8 +6,9 @@
 #include "avx512f-helper.h"
 
 #define SIZE (AVX512F_LEN / 16)
-#include "math.h"
-#include "values.h"
+#include <math.h>
+#include <limits.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 #define NUM 32
Index: gcc/testsuite/gcc.target/i386/avx512dq-vfpclassps-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512dq-vfpclassps-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512dq-vfpclassps-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,7 +6,8 @@
 #include "avx512f-helper.h"
 
 #include <math.h>
-#include <values.h>
+#include <limits.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 #define SIZE (AVX512F_LEN / 32)
 
Index: gcc/testsuite/gcc.target/i386/avx512bw-vpmaddubsw-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512bw-vpmaddubsw-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512bw-vpmaddubsw-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,7 +6,8 @@
 #include "avx512f-helper.h"
 
 #include <math.h>
-#include <values.h>
+#include <limits.h>
+#include <float.h>
 #define SIZE (AVX512F_LEN / 16)
 #include "avx512f-mask-type.h"
 
Index: gcc/testsuite/gcc.target/i386/avx512vbmi-vpermt2b-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512vbmi-vpermt2b-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512vbmi-vpermt2b-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -7,8 +7,9 @@
 #include "avx512f-helper.h"
 
 #define SIZE (AVX512F_LEN / 8)
-#include "math.h"
-#include "values.h"
+#include <math.h>
+#include <limits.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 #define NUM 32
Index: gcc/testsuite/gcc.target/i386/avx512vbmi-vpermi2b-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512vbmi-vpermi2b-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512vbmi-vpermi2b-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -7,8 +7,9 @@
 #include "avx512f-helper.h"
 
 #define SIZE (AVX512F_LEN / 8)
-#include "math.h"
-#include "values.h"
+#include <math.h>
+#include <limits.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 #define NUM 32
Index: gcc/testsuite/gcc.target/i386/avx512bw-vpermt2w-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx512bw-vpermt2w-2.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/gcc.target/i386/avx512bw-vpermt2w-2.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -6,8 +6,9 @@
 #include "avx512f-helper.h"
 
 #define SIZE (AVX512F_LEN / 16)
-#include "math.h"
-#include "values.h"
+#include <math.h>
+#include <limits.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 #define NUM 32
Index: gcc/testsuite/gfortran.dg/pr65429.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr65429.f90	(.../tags/gcc_5_1_0_release)	(wersja 0)
+++ gcc/testsuite/gfortran.dg/pr65429.f90	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -0,0 +1,19 @@
+! { dg-do run }
+! PR fortran/65429
+program foo
+
+   implicit none
+
+   character(*), parameter :: s(*) = [ character(5) :: 'abcde', 'fghij' ]
+   character(*), parameter :: t(*) = [ character(31) :: ]
+   character(*), parameter :: u(*) = [ 'qwerty', 'asdfgh', 'zxcvbn']
+   character(*), parameter :: v(*) = ['','']
+
+   if ((size(s) /= 2).or.(len(s)/=5)) call abort
+   if ((size(t) /= 0).or.(len(t)/=31)) call abort
+   if ((size(u) /= 3).or.(len(u)/=6)) call abort
+   if ((size(v) /= 2).or.(len(v)/=0)) call abort
+   if ((s(1)/='abcde').or.(s(2)/='fghij')) call abort
+   if ((u(1)/='qwerty').or.(u(2)/='asdfgh').or.(u(3)/='zxcvbn')) call abort
+
+end program foo
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/ChangeLog	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1,3 +1,17 @@
+2015-04-22  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+	PR fortran/65429
+	* gfortran.dg/pr65429.f90: New test.
+
+2015-04-22  Bin Cheng  <bin.cheng@arm.com>
+
+	Backport from trunk r222255
+	2015-04-21  Bin Cheng  <bin.cheng@arm.com>
+
+	PR testsuite/65767
+	* g++.dg/lto/pr65276_0.C: Change namespace std to std2.
+	* g++.dg/lto/pr65276_1.C: Change namespace std to std2.
+
 2015-04-22  Release Manager
 
 	* GCC 5.1.0 released.
Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype2.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype2.C	(.../tags/gcc_5_1_0_release)	(wersja 0)
+++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype2.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -0,0 +1,25 @@
+// PR c++/65727
+// { dg-do compile { target c++11 } }
+
+struct type_a { void(*cb)(); };
+
+struct type_b
+{
+    type_b(type_a p);
+    void dummy();
+};
+
+template<class T>
+constexpr T function_c(T**t) {return **t;}
+
+class type_d {
+    public:
+        static void dummy();
+};
+class type_e {
+    public:
+        static type_b b;
+        type_d *d[1];
+};
+
+type_b type_e::b = {{[](){decltype(function_c(type_e::d))::dummy();}}};
Index: gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem4.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem4.C	(.../tags/gcc_5_1_0_release)	(wersja 0)
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem4.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -0,0 +1,26 @@
+// PR c++/65695
+// { dg-do compile { target c++11 } }
+
+struct Foo;
+
+struct Bar
+{
+    using MemberFuncT = int (Foo::*)();
+
+    MemberFuncT h_;
+    constexpr Bar(MemberFuncT h) : h_{h}
+    {
+    }
+};
+
+struct Foo
+{
+    int test()
+    {
+        return -1;
+    }
+
+    static constexpr Bar bar {&Foo::test};
+};
+
+constexpr Bar Foo::bar;
Index: gcc/testsuite/g++.dg/cpp1y/auto-fn26.C
===================================================================
--- gcc/testsuite/g++.dg/cpp1y/auto-fn26.C	(.../tags/gcc_5_1_0_release)	(wersja 0)
+++ gcc/testsuite/g++.dg/cpp1y/auto-fn26.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -0,0 +1,6 @@
+// PR c++/59766
+// { dg-do compile { target c++14 } }
+
+struct T {
+  friend auto f() { }
+};
Index: gcc/testsuite/g++.dg/lookup/using55.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using55.C	(.../tags/gcc_5_1_0_release)	(wersja 0)
+++ gcc/testsuite/g++.dg/lookup/using55.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -0,0 +1,19 @@
+// PR c++/65721
+
+template<typename T>
+struct A {
+  typedef T D;
+};
+
+template<typename X>
+class B : public A<X> {
+  using typename B::D;		// { dg-error "not a base" }
+public:
+  D echo(D x) {			// { dg-error "D" }
+    return x;
+  }
+};
+
+int main() {
+  B<int> b;
+}
Index: gcc/testsuite/g++.dg/lto/pr65276_1.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr65276_1.C	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/g++.dg/lto/pr65276_1.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -3,7 +3,7 @@
 #pragma interface
 extern "C++"
 {
-  namespace std
+  namespace std2
   {
     class exception
     {
@@ -12,7 +12,7 @@
     };
   }
 }
-namespace std
+namespace std2
 {
   struct __cow_string
   {
Index: gcc/testsuite/g++.dg/lto/pr65276_0.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr65276_0.C	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/testsuite/g++.dg/lto/pr65276_0.C	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -7,7 +7,7 @@
 
 extern "C++"
 {
-  namespace std
+  namespace std2
   {
     class exception
     {
@@ -16,7 +16,7 @@
     };
   }
 }
-namespace std
+namespace std2
 {
   struct __cow_string
   {
@@ -31,9 +31,9 @@
     __cow_string _M_msg;
   };
 }
-namespace std
+namespace std2
 {
-  class system_error:public std::runtime_error
+  class system_error:public std2::runtime_error
   {
   };
   enum _Ios_Fmtflags
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/cp/decl.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -10628,7 +10628,7 @@
       }
     else if (decl_context == FIELD)
       {
-	if (!staticp && TREE_CODE (type) != METHOD_TYPE
+	if (!staticp && !friendp && TREE_CODE (type) != METHOD_TYPE
 	    && type_uses_auto (type))
 	  {
 	    error ("non-static data member declared %<auto%>");
Index: gcc/cp/ChangeLog
===================================================================
--- gcc/cp/ChangeLog	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/cp/ChangeLog	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1,3 +1,22 @@
+2015-04-22  Marek Polacek  <polacek@redhat.com>
+
+	PR c++/65727
+	* lambda.c (maybe_resolve_dummy): Handle null return.
+
+2015-04-22  Jason Merrill  <jason@redhat.com>
+
+	PR c++/65695
+	* cvt.c (cp_fold_convert): Avoid wrapping PTRMEM_CST in NOP_EXPR.
+
+	PR c++/65721
+	* name-lookup.c (do_class_using_decl): Complain about specifying
+	the current class even if there are dependent bases.
+
+2015-04-22  David Krauss  <david_work@me.com>
+
+	PR c++/59766
+	* decl.c (grokdeclarator): Do not flag friends with deduced return.
+
 2015-04-22  Release Manager
 
 	* GCC 5.1.0 released.
Index: gcc/cp/lambda.c
===================================================================
--- gcc/cp/lambda.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/cp/lambda.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -787,7 +787,7 @@
       /* In a lambda, need to go through 'this' capture.  */
       tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type);
       tree cap = lambda_expr_this_capture (lam, add_capture_p);
-      if (cap != error_mark_node)
+      if (cap && cap != error_mark_node)
 	object = build_x_indirect_ref (EXPR_LOCATION (object), cap,
 				       RO_NULL, tf_warning_or_error);
     }
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/cp/cvt.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -603,8 +603,20 @@
 tree
 cp_fold_convert (tree type, tree expr)
 {
-  tree conv = fold_convert (type, expr);
-  conv = ignore_overflows (conv, expr);
+  tree conv;
+  if (TREE_TYPE (expr) == type)
+    conv = expr;
+  else if (TREE_CODE (expr) == PTRMEM_CST)
+    {
+      /* Avoid wrapping a PTRMEM_CST in NOP_EXPR.  */
+      conv = copy_node (expr);
+      TREE_TYPE (conv) = type;
+    }
+  else
+    {
+      conv = fold_convert (type, expr);
+      conv = ignore_overflows (conv, expr);
+    }
   return conv;
 }
 
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/cp/name-lookup.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -3408,7 +3408,7 @@
 			   tf_warning_or_error);
       if (b_kind < bk_proper_base)
 	{
-	  if (!bases_dependent_p)
+	  if (!bases_dependent_p || b_kind == bk_same_type)
 	    {
 	      error_not_base_type (scope, current_class_type);
 	      return NULL_TREE;
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/fortran/decl.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1404,9 +1404,7 @@
 		    }
 		  else if (init->expr_type == EXPR_ARRAY)
 		    {
-		      gfc_constructor *c;
-		      c = gfc_constructor_first (init->value.constructor);
-		      clen = c->expr->value.character.length;
+		      clen = mpz_get_si (init->ts.u.cl->length->value.integer);
 		      sym->ts.u.cl->length
 				= gfc_get_int_expr (gfc_default_integer_kind,
 						    NULL, clen);
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/fortran/ChangeLog	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -2,6 +2,11 @@
 
 	* GCC 5.1.0 released.
 
+2015-04-22  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+	PR fortran/65429
+	* decl.c (add_init_expr_to_sym): Set the length type parameter.
+
 2015-04-10  Tobias Burnus  <burnus@net-b.de>
 
 	* trans-stmt.c (gfc_trans_lock_unlock): Implement -fcoarray=lib
Index: gcc/BASE-VER
===================================================================
--- gcc/BASE-VER	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/BASE-VER	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -1 +1 @@
-5.1.0
+5.1.1
Index: gcc/config/avr/avr.opt
===================================================================
--- gcc/config/avr/avr.opt	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/config/avr/avr.opt	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -97,4 +97,4 @@
 
 nodevicelib
 Driver Target Report RejectNegative
-Do not link against the device-specific library libdev.a
+Do not link against the device-specific library lib<MCU>.a
Index: gcc/config/avr/avr-mcus.def
===================================================================
--- gcc/config/avr/avr-mcus.def	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/config/avr/avr-mcus.def	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -44,8 +44,8 @@
                      used by DRIVER_SELF_SPECS and gen-avr-mmcu-specs.c for
                      - the name of the device specific specs file
                        in -specs=device-specs/spec-<NAME>
-                     - the name of the startup file dev/<NAME>/crt1.o
-                     - the name of the device library dev/<NAME>/libdev.a
+                     - the name of the startup file crt<NAME>.o
+                     - to link the device library by means of -l<NAME>
 
        ARCH          Specifies the multilib variant together with AVR_SHORT_SP
 
Index: gcc/config/avr/gen-avr-mmcu-specs.c
===================================================================
--- gcc/config/avr/gen-avr-mmcu-specs.c	(.../tags/gcc_5_1_0_release)	(wersja 222352)
+++ gcc/config/avr/gen-avr-mmcu-specs.c	(.../branches/gcc-5-branch)	(wersja 222352)
@@ -171,11 +171,11 @@
   if (is_device)
     {
       fprintf (f, "*avrlibc_startfile:\n");
-      fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
+      fprintf (f, "\tcrt%s.o%%s", mcu->name);
       fprintf (f, "\n\n");
 
       fprintf (f, "*avrlibc_devicelib:\n");
-      fprintf (f, "\t%%{!nodevicelib:dev/%s/libdev.a%%s}", mcu->name);
+      fprintf (f, "\t%%{!nodevicelib:-l%s}", mcu->name);
       fprintf (f, "\n\n");
     }
 #endif  // WITH_AVRLIBC
