From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IGHVDgZG5WODWC4AWB0awg (envelope-from ) for ; Thu, 09 Feb 2023 14:14:14 -0500 Received: by simark.ca (Postfix, from userid 112) id 28CD31E221; Thu, 9 Feb 2023 14:14:14 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=e9QQfUF0; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C36751E110 for ; Thu, 9 Feb 2023 14:14:13 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C0443858022 for ; Thu, 9 Feb 2023 19:14:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C0443858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675970053; bh=0o3xCwQY9DmJw5vJIkBefw8DOeh85ewAIyDQfGIhp04=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=e9QQfUF0c76EOfeEmV2rAHMssCk5K9GB0nx8g7CBC/Zf+DpeiQB+774l51hKeaic3 hwPgP5DZ/IS3y+DM3oR/cxKJFrXxoy/jxeecN2coSXlZSPs0hjQiBihoQfOaixT1lx h6MRlSi3mpC7RqGPIMvbOEHcVUtxXtJvMXDxKbV8= 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 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) 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: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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