From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 2B0873858C5F for ; Thu, 9 Feb 2023 19:13:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B0873858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AE17E1E110; Thu, 9 Feb 2023 14:13:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1675970032; bh=AVdFTl2/xX7hgYoS5oEFy7jOnpRVLQ/bjuQWotRmrCQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=ImYsfycNNSB7G9c14PF9rdHbz/sU9vsRg9OotCUV5MiNX/wwzAlJk1os0Y5Nt0PjH elo5cpNf161REBZaXB88rB9GooBAG6Rz0BjyDk4zJpr08LQa4xlF1Q1WPac/d9w77v WOg5csGuB8qnymcQYEUyI1C5PblVFkM+JY432k+Q= Message-ID: <02654c79-55cc-1f50-a3c6-4f1b62334399@simark.ca> Date: Thu, 9 Feb 2023 14:13:52 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [COMMITTED PATCH] [aarch64] Avoid initializers for VLAs Content-Language: fr To: Roland McGrath , GDB References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2/9/23 14:06, Roland McGrath via Gdb-patches wrote: > C99 does not permit initializers for variable length arrays, and Clang > now enforces this. > Committed as obvious enough. > > commit b695fdd9b2494a64db1fb8e584753a1a5afec494 (HEAD -> master) > Author: Roland McGrath > Date: Thu Feb 9 10:47:17 2023 -0800 > > [aarch64] Avoid initializers for VLAs > > Clang doesn't accept initializer syntax for variable-length > arrays in C. Just use memset instead. "C99" and "C" don't really make sense, since this is C++. Perhaps it's the same error in C++, but the message is a bit misleading. It's too late for this one, but when fixing a compilation error, please put the compiler error in the commit message. > > 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 @@ > > #include "nat/aarch64-mte-linux-ptrace.h" > > +#include > + > #ifndef TRAP_HWBKPT > #define TRAP_HWBKPT 0x0004 > #endif > @@ -445,7 +447,9 @@ fetch_tlsregs_from_thread (struct regcache *regcache) > gdb_assert (regno != -1); > gdb_assert (tdep->tls_register_count > 0); > > - uint64_t tpidrs[tdep->tls_register_count] = { 0 }; > + uint64_t tpidrs[tdep->tls_register_count]; > + memset(tpidrs, 0, sizeof(tpidrs)); Missing space before parentheses. > + > struct iovec iovec; > iovec.iov_base = tpidrs; > iovec.iov_len = sizeof (tpidrs); > @@ -471,7 +475,8 @@ store_tlsregs_to_thread (struct regcache *regcache) > gdb_assert (regno != -1); > gdb_assert (tdep->tls_register_count > 0); > > - uint64_t tpidrs[tdep->tls_register_count] = { 0 }; > + uint64_t tpidrs[tdep->tls_register_count]; > + memset(tpidrs, 0, sizeof(tpidrs)); Same. Simon