From nobody Tue Nov 26 01:46:35 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81CEB1BE250 for ; Tue, 22 Oct 2024 17:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617844; cv=none; b=WXzqH4YQwX3voKs3wGVFPZ/vnfBPB+hIseKvBU0RBgK1Q2bx4DRaYYHN/b20qdjyVMNzFZm5g/6qM6cbBrg/rfq0a7F1xdRRdGbBcmpb1PXv2gQG5bkusC9IRTO77JZbIO+icW+M6ONIy9dvEQK9/dZUpFb1jwhd/7q/nzMGe6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617844; c=relaxed/simple; bh=SaqctSPFGF6+q/43+UbfzYOhWmidNdBhOWKugsa7uNA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ufR7BsjcDVU2Ll1PdULI1R0JEZeMSsM2P7pG5YtYHtoNPo8qmnA6yWpW7l9CLWBEr4C9SZAsddNdERvI7qbygchpLsjyAQHvuyReVoft7tHwu7ufOYaspLkggmD4jvPdmGJpzszQAun3OoLmgcdiMxFMzzCXomaITfaN0/fWc4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=i/PnD5Rk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i/PnD5Rk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729617841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hrA6XcsZzgghH+9JDOcIvHjo0+Ys4rAGu6oSgw/o1H8=; b=i/PnD5RkMnt4el3ckCfC64FdWG5ClysdQBmvTKSPm4gyXWOCD7H62LZbmT0c8Y1HNVyxTo ruMQzpG4uHeDh8E6LstW5x5oHCmTiC86StEZ7bhe/X1IRjla5djwv3lrupYX1PjNzU43n5 Zy1EuhIfk9QdQSTqCUd7c8M0ydRfnbE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-JhPFMKQpO2q5Olk4kBzqng-1; Tue, 22 Oct 2024 13:23:57 -0400 X-MC-Unique: JhPFMKQpO2q5Olk4kBzqng-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CEC851955D5E; Tue, 22 Oct 2024 17:23:54 +0000 (UTC) Received: from f39.redhat.com (unknown [10.39.192.92]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02F5D1955E8F; Tue, 22 Oct 2024 17:23:47 +0000 (UTC) From: Eder Zulian To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, acme@redhat.com, vmalik@redhat.com, williams@redhat.com Subject: [PATCH v2 1/3] resolve_btfids: Fix compiler warnings Date: Tue, 22 Oct 2024 19:23:27 +0200 Message-ID: <20241022172329.3871958-2-ezulian@redhat.com> In-Reply-To: <20241022172329.3871958-1-ezulian@redhat.com> References: <20241022172329.3871958-1-ezulian@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Initialize 'set' and 'set8' pointers to NULL in sets_patch to prevent possible compiler warnings which are issued for various optimization levels, but do not happen when compiling with current default compilation options. For example, when compiling resolve_btfids with $ make "HOSTCFLAGS=3D-O2 -Wall" -C tools/bpf/resolve_btfids/ clean all Clang version 17.0.6 and GCC 13.3.1 issue following -Wmaybe-uninitialized warnings for variables 'set8' and 'set': In function =E2=80=98sets_patch=E2=80=99, inlined from =E2=80=98symbols_patch=E2=80=99 at main.c:748:6, inlined from =E2=80=98main=E2=80=99 at main.c:823:6: main.c:163:9: warning: =E2=80=98set8=E2=80=99 may be used uninitialized [= -Wmaybe-uninitialized] 163 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:729:17: note: in expansion of macro =E2=80=98pr_debug=E2=80=99 729 | pr_debug("sorting addr %5lu: cnt %6d [%s]\n", | ^~~~~~~~ main.c: In function =E2=80=98main=E2=80=99: main.c:682:37: note: =E2=80=98set8=E2=80=99 was declared here 682 | struct btf_id_set8 *set8; | ^~~~ In function =E2=80=98sets_patch=E2=80=99, inlined from =E2=80=98symbols_patch=E2=80=99 at main.c:748:6, inlined from =E2=80=98main=E2=80=99 at main.c:823:6: main.c:163:9: warning: =E2=80=98set=E2=80=99 may be used uninitialized [-= Wmaybe-uninitialized] 163 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:729:17: note: in expansion of macro =E2=80=98pr_debug=E2=80=99 729 | pr_debug("sorting addr %5lu: cnt %6d [%s]\n", | ^~~~~~~~ main.c: In function =E2=80=98main=E2=80=99: main.c:683:36: note: =E2=80=98set=E2=80=99 was declared here 683 | struct btf_id_set *set; | ^~~ Signed-off-by: Eder Zulian Acked-by: Jiri Olsa --- tools/bpf/resolve_btfids/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/mai= n.c index d54aaa0619df..bd9f960bce3d 100644 --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -679,8 +679,8 @@ static int sets_patch(struct object *obj) =20 next =3D rb_first(&obj->sets); while (next) { - struct btf_id_set8 *set8; - struct btf_id_set *set; + struct btf_id_set8 *set8 =3D NULL; + struct btf_id_set *set =3D NULL; unsigned long addr, off; struct btf_id *id; =20 --=20 2.46.2 From nobody Tue Nov 26 01:46:35 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 139971BDA81 for ; Tue, 22 Oct 2024 17:24:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617850; cv=none; b=p/z/XcpvWaCF6z8Z9kIVATLmE6U4eMDoIIqUwrMByf9avI95BHCFMerb8RdV+hy9r+h38D1g7vE11frmVLOrIo7pX27ZpxrHL9Yigity0G6HAAGLLpNOO2k15IMoR0LZyAsgMSmX86JpchEeC6kwcNZIFURXSAHN2d3NLoqjCqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617850; c=relaxed/simple; bh=JmAPWXy5Vw82/y6UIjvkoXH3JKleNwrq4qEmYsUb6Tk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eRzKHouLZaaPSQ1SPTCRgNko1B/+Y3Sp3RfcuvCMujsFeE2ZkmP6ya/ax/Ls3YfdPsYdF7PjXVs26pCuu2+WacoX/KLIqcJfYCjm+/em7i5Yyah0oInrfUCbGimk/6CrQvntESYtL/WWURuvsgS/z5M62mQhxfX25q9DItVII9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iiotXc66; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iiotXc66" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729617848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RYRR3poErCjI6KOljjS6hUlitC7Nqrgyj2rhxhner44=; b=iiotXc66kc3mehOFoMgqRtMXII9f6/MudbgHI7NNemQcd/ItMUR4nRddXww7C7+k21VFUy NNIh7TKGoG/Me1AEOVt6BgBzl1C8l16tuuivn71D2iEQkCAumRff4k3O78ba2v+KwpFD6/ ScWY+VBl2OlsHgwC0UFf9jvNwE05XDU= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-33VY614oMV2Pruptxc8tHA-1; Tue, 22 Oct 2024 13:24:02 -0400 X-MC-Unique: 33VY614oMV2Pruptxc8tHA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FDFA1955F3C; Tue, 22 Oct 2024 17:24:00 +0000 (UTC) Received: from f39.redhat.com (unknown [10.39.192.92]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F4BD19560B2; Tue, 22 Oct 2024 17:23:55 +0000 (UTC) From: Eder Zulian To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, acme@redhat.com, vmalik@redhat.com, williams@redhat.com Subject: [PATCH v2 2/3] libbpf: Prevent compiler warnings/errors Date: Tue, 22 Oct 2024 19:23:28 +0200 Message-ID: <20241022172329.3871958-3-ezulian@redhat.com> In-Reply-To: <20241022172329.3871958-1-ezulian@redhat.com> References: <20241022172329.3871958-1-ezulian@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Initialize 'new_off' and 'pad_bits' to 0 and 'pad_type' to NULL in btf_dump_emit_bit_padding to prevent compiler warnings/errors which are observed when compiling with 'EXTRA_CFLAGS=3D-g -Og' options, but do not happen when compiling with current default options. For example, when compiling libbpf with $ make "EXTRA_CFLAGS=3D-g -Og" -C tools/lib/bpf/ clean all Clang version 17.0.6 and GCC 13.3.1 fail to compile btf_dump.c due to following errors: btf_dump.c: In function =E2=80=98btf_dump_emit_bit_padding=E2=80=99: btf_dump.c:903:42: error: =E2=80=98new_off=E2=80=99 may be used uninitial= ized [-Werror=3Dmaybe-uninitialized] 903 | if (new_off > cur_off && new_off <=3D next_off) { | ~~~~~~~~^~~~~~~~~~~ btf_dump.c:870:13: note: =E2=80=98new_off=E2=80=99 was declared here 870 | int new_off, pad_bits, bits, i; | ^~~~~~~ btf_dump.c:917:25: error: =E2=80=98pad_type=E2=80=99 may be used uninitia= lized [-Werror=3Dmaybe-uninitialized] 917 | btf_dump_printf(d, "\n%s%s: %d;", pfx(lvl= ), pad_type, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~ 918 | in_bitfield ? new_off - c= ur_off : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~ btf_dump.c:871:21: note: =E2=80=98pad_type=E2=80=99 was declared here 871 | const char *pad_type; | ^~~~~~~~ btf_dump.c:930:20: error: =E2=80=98pad_bits=E2=80=99 may be used uninitia= lized [-Werror=3Dmaybe-uninitialized] 930 | if (bits =3D=3D pad_bits) { | ^ btf_dump.c:870:22: note: =E2=80=98pad_bits=E2=80=99 was declared here 870 | int new_off, pad_bits, bits, i; | ^~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Eder Zulian Acked-by: Jiri Olsa --- tools/lib/bpf/btf_dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 8440c2c5ad3e..468392f9882d 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -867,8 +867,8 @@ static void btf_dump_emit_bit_padding(const struct btf_= dump *d, } pads[] =3D { {"long", d->ptr_sz * 8}, {"int", 32}, {"short", 16}, {"char", 8} }; - int new_off, pad_bits, bits, i; - const char *pad_type; + int new_off =3D 0, pad_bits =3D 0, bits, i; + const char *pad_type =3D NULL; =20 if (cur_off >=3D next_off) return; /* no gap */ --=20 2.46.2 From nobody Tue Nov 26 01:46:35 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8E5F1BDA99 for ; Tue, 22 Oct 2024 17:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617856; cv=none; b=I4W62MTkefRfgeGpu8bPUijXpR3tamnm9gUnyWbTuQAj2fvFyXjCEgPAvJfREcEu61jBRkzQ0AoOGVGhEysgIdW3HLMQuuNFf1yMLidL+iCe8IYLyZRk21ykoeBrJ4pi0hA04Hpcob0xYNUetdFLnKhHc+KmZlGZOElwjGdAf0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729617856; c=relaxed/simple; bh=7A+wqXFqVEEFcs32UD2pyejQfKgGBcn0hHv+lq3Wn84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rk09WMPHMRtmYYe0ZZaDPz8wmzvkQhZ4/ZaafUyYKoiFJeliujEFeHBNjWMBg2XeSexheyUiAv1XN4kxaft3SyPvoXIVGOwuiVDp6tF1+6j0tW0VpXy08Khttx9hf1sQyB2HBBk1XWsZhynGI35kkV+YxjvIp2xfK70eHRQyDFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZHyB8fjt; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZHyB8fjt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729617853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+Wj5eXI3hv/U03ptO++QyvhlUUq9Z9g1YTNX9l3We/8=; b=ZHyB8fjtCouhG3rleoQW/Vezi7ztQ1kgqVPJ1GRz0wW9gXWVGQEwI02S/wiV7r9wR8VJDg GPeaNsRmXspPjZJ20y4vvvUwH8Q7h5kx2VcsqMEHBjbEAjIP5hhxs2hDQimUDm0yrqH+wj M9+gWX7zRJ7oDN5BySzbfOSury8EHrY= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-zaLiM4tDNzulnG4h4IHkoA-1; Tue, 22 Oct 2024 13:24:10 -0400 X-MC-Unique: zaLiM4tDNzulnG4h4IHkoA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B9E381955EAB; Tue, 22 Oct 2024 17:24:07 +0000 (UTC) Received: from f39.redhat.com (unknown [10.39.192.92]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A53EE1955F30; Tue, 22 Oct 2024 17:24:00 +0000 (UTC) From: Eder Zulian To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, acme@redhat.com, vmalik@redhat.com, williams@redhat.com Subject: [PATCH v2 3/3] libsubcmd: Silence compiler warning Date: Tue, 22 Oct 2024 19:23:29 +0200 Message-ID: <20241022172329.3871958-4-ezulian@redhat.com> In-Reply-To: <20241022172329.3871958-1-ezulian@redhat.com> References: <20241022172329.3871958-1-ezulian@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Initialize the pointer 'o' in options__order to NULL to prevent a compiler warning/error which is observed when compiling with the '-Og' option, but is not emitted by the compiler with the current default compilation options. For example, when compiling libsubcmd with $ make "EXTRA_CFLAGS=3D-Og" -C tools/lib/subcmd/ clean all Clang version 17.0.6 and GCC 13.3.1 fail to compile parse-options.c due to following error: parse-options.c: In function =E2=80=98options__order=E2=80=99: parse-options.c:832:9: error: =E2=80=98o=E2=80=99 may be used uninitializ= ed [-Werror=3Dmaybe-uninitialized] 832 | memcpy(&ordered[nr_opts], o, sizeof(*o)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parse-options.c:810:30: note: =E2=80=98o=E2=80=99 was declared here 810 | const struct option *o, *p =3D opts; | ^ cc1: all warnings being treated as errors Signed-off-by: Eder Zulian Acked-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa --- tools/lib/subcmd/parse-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-opti= ons.c index eb896d30545b..555d617c1f50 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -807,7 +807,7 @@ static int option__cmp(const void *va, const void *vb) static struct option *options__order(const struct option *opts) { int nr_opts =3D 0, nr_group =3D 0, nr_parent =3D 0, len; - const struct option *o, *p =3D opts; + const struct option *o =3D NULL, *p =3D opts; struct option *opt, *ordered =3D NULL, *group; =20 /* flatten the options that have parents */ --=20 2.46.2