From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7824) id DBBE038A90A4; Tue, 15 Nov 2022 19:04:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBBE038A90A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668539087; bh=i+avVTVAwgdYzaRAICaUnQEoaNhiZRA1F0i/zbYwZaE=; h=From:To:Subject:Date:From; b=sluo2zI2jCnG/jn7liWarJ7yNkB6NAxyIFVM8WUbwFH3+4wKg7fZUnUzexRmZMMzl SJNwcU60/2O/pDgHYxjgbgQNZg6bxbDS7aMAAF9psS4mxXoueyPM14pfVhGto6Xkyk brzfc/U0y85Uo2PK7CPmjACFYWxtFjz4UG8qCSWI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: David Faust To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4075] bpf: avoid possible use of uninitialized variable X-Act-Checkin: gcc X-Git-Author: David Faust X-Git-Refname: refs/heads/master X-Git-Oldrev: 86a90006864840c2e222d46ead551850caba184b X-Git-Newrev: 6052482f841634522c6d2e56c4231f8df2dc6d3e Message-Id: <20221115190447.DBBE038A90A4@sourceware.org> Date: Tue, 15 Nov 2022 19:04:47 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6052482f841634522c6d2e56c4231f8df2dc6d3e commit r13-4075-g6052482f841634522c6d2e56c4231f8df2dc6d3e Author: David Faust Date: Tue Nov 15 09:21:51 2022 -0800 bpf: avoid possible use of uninitialized variable Fix a maybe-uninitialized warning introduced in commit: 068baae1864 bpf: add preserve_field_info builtin gcc/ * config/bpf/bpf.cc (bpf_expand_builtin): Avoid use of uninitialized variable in error case. Diff: --- gcc/config/bpf/bpf.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 16af2412bf6..51e46955015 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -1254,11 +1254,14 @@ bpf_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, /* A resolved overloaded __builtin_preserve_field_info. */ tree src = CALL_EXPR_ARG (exp, 0); tree kind_tree = CALL_EXPR_ARG (exp, 1); - unsigned HOST_WIDE_INT kind_val; + unsigned HOST_WIDE_INT kind_val = 0; if (tree_fits_uhwi_p (kind_tree)) kind_val = tree_to_uhwi (kind_tree); else - error ("invalid argument to built-in function"); + { + error ("invalid argument to built-in function"); + return expand_normal (error_mark_node); + } enum btf_core_reloc_kind kind = (enum btf_core_reloc_kind) kind_val;