sim/m32r: Initialize "list" variable

The variable "list" is only initialized when arg1 > 0 and when arg1 == 0,
an uninitialized value is passed to translate_endian_h2t function.

Although this behavior is harmless, this commit adds initialization to avoid
a GCC warning ("-Wmaybe-uninitialized").
This commit is contained in:
Tsukasa OI
2022-09-26 07:03:00 +00:00
parent 57e3eee069
commit 45f8296e69

View File

@ -547,7 +547,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
case TARGET_LINUX_SYS_getgroups32:
case TARGET_LINUX_SYS_getgroups:
{
gid_t *list;
gid_t *list = NULL;
if (arg1 > 0)
list = (gid_t *) malloc (arg1 * sizeof(gid_t));