From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2Nl5C8AhaGetfikAWB0awg (envelope-from ) for ; Sun, 22 Dec 2024 09:27:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1734877632; bh=x2rnXcG0CAII5GfreBorYojB6xBlGxFVefh82SC0Osc=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OgH48FkY7q45rCpGW64xtYPiserFLEMlAAZT+g5THWixxaxSw69ULv6+NOBPAQWdj H8bU70KoQcWpUllS2Qn0cOXifhx6747GGS+cVUX+uaTUi7YwUfODldTXQVOdI/KbZx wmIK5WrJwHWvLx/sva7eZZFePT+HpuanoPVMHKZc= Received: by simark.ca (Postfix, from userid 112) id 2AEE71E097; Sun, 22 Dec 2024 09:27:12 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.0 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=hfztxPWM; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=j/hfp0jC; dkim-atps=neutral Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BF58E1E05C for ; Sun, 22 Dec 2024 09:27:11 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6E58C385841D for ; Sun, 22 Dec 2024 14:27:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E58C385841D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=hfztxPWM; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=j/hfp0jC Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 35D193858D3C for ; Sun, 22 Dec 2024 14:26:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35D193858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 35D193858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734877602; cv=none; b=lXd/KTSBGp3ExjwyXP9Tta99iSlVW/ejxVg8PnKeE+f1hjwnAzNIANjWqGZgb3BHTp234HJIa/Fs93bHi5cTy5QrHROvNJXzfPJNaUaxbaEnNfBTtT3U96ubbUgJi3tOYjkq9l+O+7rrS82lx5SFNFnZcIbaQAHiuUO86+TXjuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734877602; c=relaxed/simple; bh=x2rnXcG0CAII5GfreBorYojB6xBlGxFVefh82SC0Osc=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=Fg0LeAta9hd9V5RgT/2wWWsrAMOMz5KtaMPqhlA2+82CIH2a/nRWduD3N1exTcVYBQSdZurdwgkGOeI9Io1HfzQPNb1JJImUgZxYCKIazI46/ToytD6R1Z+bSgLk0QA8BqsFe9AKvTz3FZG5X49XMGm9UKOYYb8bnhMGMafV5Dg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35D193858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1734877601; bh=x2rnXcG0CAII5GfreBorYojB6xBlGxFVefh82SC0Osc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=hfztxPWMwn9JvuMWenf/aWdd2TSWQI5esw4sKZ6h9zh+KyzVARWV5VumbQ9SRzIhE M8Ql9UvOiljeZemw9nm3OGTqUC2yGpT4OPhQo4RCQmdrEI9YTqpEMu3Ci6YGWQJoqZ WVyyBCSpeVfkOPzGI9S1qGgDvxfKtyXnU2DCKbHE= Received: by simark.ca (Postfix, from userid 112) id 8DC391E097; Sun, 22 Dec 2024 09:26:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1734877600; bh=x2rnXcG0CAII5GfreBorYojB6xBlGxFVefh82SC0Osc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=j/hfp0jCL9GI8fFCIhcfMwT35+6dUGd+GrCcs/PWAakQxGLtYRmZDzLISBntcJC34 71lePbpGUhdvKU07KVAEKBuwfzOhugv1aBM+jTTs75W5njxhLf7nHE2U+KM0Nxo8W8 +y9+rMa25UAjp6d8S2K8YXh6QN3S0dlcv52sf5YM= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AA3371E05C; Sun, 22 Dec 2024 09:26:40 -0500 (EST) Message-ID: Date: Sun, 22 Dec 2024 09:26:40 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Hurd: remove VLA usage. To: Flavio Cruz , gdb-patches References: Content-Language: en-US From: Simon Marchi 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2024-12-22 00:34, Flavio Cruz wrote: > Compilation will fail with -Werror=vla, which seems to be the default. > > Note that we don't need to allocate num_threads + 1 since the matching > algorithm works only on the num_threads as returned by task_threads. > --- > gdb/gnu-nat.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c > index a8a4da1c..ab157094 100644 > --- a/gdb/gnu-nat.c > +++ b/gdb/gnu-nat.c > @@ -1016,15 +1016,13 @@ gnu_nat_target::inf_validate_procs (struct inf *inf) > { > /* Make things normally linear. */ > mach_msg_type_number_t search_start = 0; > - /* Which thread in PROCS corresponds to each task thread, & the task. */ > - struct proc *matched[num_threads + 1]; > + /* Which thread in PROCS corresponds to each task thread. */ > + std::vector matched (num_threads); > /* The last thread in INF->threads, so we can add to the end. */ > struct proc *last = 0; > /* The current thread we're considering. */ > struct proc *thread = inf->threads; > > - memset (matched, 0, sizeof (matched)); > - > while (thread) > { > mach_msg_type_number_t left; Thanks, I pushed that for you. I made a minor modification, adding newlines before the comments between the declarations. Simon