The previous code triggered the following error on an i386 host:
/git/gdb/gdb/ppc-sysv-tdep.c:1764:34: error: non-constant-expression cannot be narrowed from type 'ULONGEST' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
^~~~~~~~~~~~~~~~~~~~~
/git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
^~~~~~~~~~~~~~~~~~
/git/gdb/gdb/ppc-sysv-tdep.c:1764:34: note: insert an explicit cast to silence this issue
unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
^~~~~~~~~~~~~~~~~~~~~
static_cast<size_t>( )
/git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
^~~~~~~~~~~~~~~~~~
1 error generated.
Fix this by using gdb::make_array_view.
/* Fixed point type values need to be returned unscaled. */
gdb_mpz unscaled;
- unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
+ unscaled.read (gdb::make_array_view (writebuf,
+ TYPE_LENGTH (valtype)),
type_byte_order (valtype),
valtype->is_unsigned ());
return_val = unscaled.as_integer<LONGEST> ();