From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2144) id 06F813858C5F; Thu, 9 Feb 2023 19:06:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06F813858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675969593; bh=5ZmTcUZ0a6s6UMcMJWhN1JHoBX2oSuOZLx8LkgZ7LAE=; h=From:To:Subject:Date:From; b=vgPjSTZcBXGmGqgCgP+kOVefDkbXh0ko8wuIH+D1fXTpGsjpo32AjWiFUTg2EBfY2 wQiaRl9wrdeSuttOKLgKiOuQJ4kVrZx+B9Qx3+AetSBHxZapOF9SA2gv1Qi/t+SuV4 tAStBzECq3Gn1sShAcUOzBBEOcaE8Ah4ja2fBZUw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Roland McGrath To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [aarch64] Avoid initializers for VLAs X-Act-Checkin: binutils-gdb X-Git-Author: Roland McGrath X-Git-Refname: refs/heads/master X-Git-Oldrev: 31cf28c7842497aa1f6472b7d76828cf009d2298 X-Git-Newrev: b695fdd9b2494a64db1fb8e584753a1a5afec494 Message-Id: <20230209190633.06F813858C5F@sourceware.org> Date: Thu, 9 Feb 2023 19:06:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db695fdd9b249= 4a64db1fb8e584753a1a5afec494 commit b695fdd9b2494a64db1fb8e584753a1a5afec494 Author: Roland McGrath Date: Thu Feb 9 10:47:17 2023 -0800 [aarch64] Avoid initializers for VLAs =20 Clang doesn't accept initializer syntax for variable-length arrays in C. Just use memset instead. Diff: --- gdb/aarch64-linux-nat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index e4158236db2..ecb2eeb9540 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -56,6 +56,8 @@ =20 #include "nat/aarch64-mte-linux-ptrace.h" =20 +#include + #ifndef TRAP_HWBKPT #define TRAP_HWBKPT 0x0004 #endif @@ -445,7 +447,9 @@ fetch_tlsregs_from_thread (struct regcache *regcache) gdb_assert (regno !=3D -1); gdb_assert (tdep->tls_register_count > 0); =20 - uint64_t tpidrs[tdep->tls_register_count] =3D { 0 }; + uint64_t tpidrs[tdep->tls_register_count]; + memset(tpidrs, 0, sizeof(tpidrs)); + struct iovec iovec; iovec.iov_base =3D tpidrs; iovec.iov_len =3D sizeof (tpidrs); @@ -471,7 +475,8 @@ store_tlsregs_to_thread (struct regcache *regcache) gdb_assert (regno !=3D -1); gdb_assert (tdep->tls_register_count > 0); =20 - uint64_t tpidrs[tdep->tls_register_count] =3D { 0 }; + uint64_t tpidrs[tdep->tls_register_count]; + memset(tpidrs, 0, sizeof(tpidrs)); =20 for (int i =3D 0; i < tdep->tls_register_count; i++) {