diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 0d3a49550530..eaf2a7e97949 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -263,14 +263,14 @@ static void
 alpha_value_to_register (frame_info_ptr frame, int regnum,
 			 struct type *valtype, const gdb_byte *in)
 {
-  gdb_byte out[ALPHA_REGISTER_SIZE];
-
+  int reg_size = register_size (get_frame_arch (frame), regnum);
   gdb_assert (valtype->length () == 4);
-  gdb_assert (register_size (get_frame_arch (frame), regnum)
-	      <= ALPHA_REGISTER_SIZE);
-  alpha_lds (get_frame_arch (frame), out, in);
+  gdb_assert (reg_size <= ALPHA_REGISTER_SIZE);
 
-  put_frame_register (frame, regnum, out);
+  gdb_byte out[ALPHA_REGISTER_SIZE];
+  alpha_lds (get_frame_arch (frame), out, in);
+  auto out_view = gdb::make_array_view (out, reg_size);
+  put_frame_register (frame, regnum, out_view);
 }
 
 
diff --git a/gdb/frame.c b/gdb/frame.c
index 08ce21705432..9312d1b40168 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1424,7 +1424,7 @@ read_frame_register_unsigned (frame_info_ptr frame, int regnum,
 
 void
 put_frame_register (frame_info_ptr frame, int regnum,
-		    const gdb_byte *buf)
+		    gdb::array_view<const gdb_byte> buf)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   int realnum;
@@ -1432,6 +1432,9 @@ put_frame_register (frame_info_ptr frame, int regnum,
   int unavail;
   enum lval_type lval;
   CORE_ADDR addr;
+  int size = register_size (gdbarch, regnum);
+
+  gdb_assert (buf.size () == size);
 
   frame_register (frame, regnum, &optim, &unavail,
 		  &lval, &addr, &realnum, NULL);
@@ -1441,7 +1444,7 @@ put_frame_register (frame_info_ptr frame, int regnum,
     {
     case lval_memory:
       {
-	write_memory (addr, buf, register_size (gdbarch, regnum));
+	write_memory (addr, buf.data (), size);
 	break;
       }
     case lval_register:
@@ -1577,7 +1580,7 @@ put_frame_register_bytes (frame_info_ptr frame, int regnum,
 				    buffer.size ());
 
       if (curr_len == register_size (gdbarch, regnum))
-	put_frame_register (frame, regnum, buffer.data ());
+	put_frame_register (frame, regnum, buffer.slice (0, curr_len));
       else
 	{
 	  value *value
@@ -1587,7 +1590,7 @@ put_frame_register_bytes (frame_info_ptr frame, int regnum,
 
 	  copy (buffer.slice (0, curr_len),
 		value->contents_writeable ().slice (offset, curr_len));
-	  put_frame_register (frame, regnum, value->contents_raw ().data ());
+	  put_frame_register (frame, regnum, value->contents_raw ());
 	  release_value (value);
 	}
 
diff --git a/gdb/frame.h b/gdb/frame.h
index 19bf81766822..4117e169379a 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -731,7 +731,7 @@ extern bool read_frame_register_unsigned (frame_info_ptr frame,
    frame.  Note: this call makes the frame's state undefined.  The
    register and frame caches must be flushed.  */
 extern void put_frame_register (frame_info_ptr frame, int regnum,
-				const gdb_byte *buf);
+				gdb::array_view<const gdb_byte> buf);
 
 /* Read LEN bytes from one or multiple registers starting with REGNUM
    in frame FRAME, starting at OFFSET, into BUF.  If the register
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f356995520fe..3afa902767e5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3917,7 +3917,8 @@ i386_value_to_register (frame_info_ptr frame, int regnum,
       gdb_assert (regnum != -1);
       gdb_assert (register_size (get_frame_arch (frame), regnum) == 4);
 
-      put_frame_register (frame, regnum, from);
+      auto from_view = gdb::make_array_view (from, 4);
+      put_frame_register (frame, regnum, from_view);
       regnum = i386_next_regnum (regnum);
       len -= 4;
       from += 4;
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index b9c9e476e936..b39ca2adef55 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -397,8 +397,10 @@ i387_value_to_register (frame_info_ptr frame, int regnum,
     }
 
   /* Convert from TYPE.  */
-  target_float_convert (from, type, to, i387_ext_type (gdbarch));
-  put_frame_register (frame, regnum, to);
+  struct type *to_type = i387_ext_type (gdbarch);
+  target_float_convert (from, type, to, to_type);
+  auto to_view = gdb::make_array_view (to, to_type->length ());
+  put_frame_register (frame, regnum, to_view);
 }
 
 
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 6d537c4c8d36..f778c092537b 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1245,8 +1245,10 @@ ia64_value_to_register (frame_info_ptr frame, int regnum,
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   gdb_byte out[IA64_FP_REGISTER_SIZE];
-  target_float_convert (in, valtype, out, ia64_ext_type (gdbarch));
-  put_frame_register (frame, regnum, out);
+  type *to_type = ia64_ext_type (gdbarch);
+  target_float_convert (in, valtype, out, to_type);
+  auto out_view = gdb::make_array_view (out, to_type->length ());
+  put_frame_register (frame, regnum, out_view);
 }
 
 
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 0b761d019f2a..2e8043af0e06 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -236,8 +236,8 @@ m68k_value_to_register (frame_info_ptr frame, int regnum,
 			struct type *type, const gdb_byte *from)
 {
   gdb_byte to[M68K_MAX_REGISTER_SIZE];
-  struct type *fpreg_type = register_type (get_frame_arch (frame),
-					   M68K_FP0_REGNUM);
+  gdbarch *arch = get_frame_arch (frame);
+  struct type *fpreg_type = register_type (arch, M68K_FP0_REGNUM);
 
   /* We only support floating-point values.  */
   if (type->code () != TYPE_CODE_FLT)
@@ -249,7 +249,8 @@ m68k_value_to_register (frame_info_ptr frame, int regnum,
 
   /* Convert from TYPE.  */
   target_float_convert (from, type, to, fpreg_type);
-  put_frame_register (frame, regnum, to);
+  auto to_view = gdb::make_array_view (to, fpreg_type->length ());
+  put_frame_register (frame, regnum, to_view);
 }
 
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c7157c19e7be..16edfdb0f1b8 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -990,8 +990,9 @@ mips_value_to_register (frame_info_ptr frame, int regnum,
 
   if (mips_convert_register_float_case_p (gdbarch, regnum, type))
     {
-      put_frame_register (frame, regnum + 0, from + 4);
-      put_frame_register (frame, regnum + 1, from + 0);
+      auto from_view = gdb::make_array_view (from, 8);
+      put_frame_register (frame, regnum, from_view.slice (4));
+      put_frame_register (frame, regnum + 1, from_view.slice (0, 4));
     }
   else if (mips_convert_register_gpreg_case_p (gdbarch, regnum, type))
     {
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 16f3da9c0117..cbbaf6d83a19 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2741,9 +2741,10 @@ rs6000_value_to_register (frame_info_ptr frame,
      fpr to vsr.  */
   regnum = ieee_128_float_regnum_adjust (gdbarch, type, regnum);
 
-  target_float_convert (from, type,
-			to, builtin_type (gdbarch)->builtin_double);
-  put_frame_register (frame, regnum, to);
+  struct type *to_type = builtin_type (gdbarch)->builtin_double;
+  target_float_convert (from, type, to, to_type);
+  auto to_view = gdb::make_array_view (to, to_type->length ());
+  put_frame_register (frame, regnum, to_view);
 }
 
 static struct value *
