public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4075] bpf: avoid possible use of uninitialized variable
@ 2022-11-15 19:04 David Faust
0 siblings, 0 replies; only message in thread
From: David Faust @ 2022-11-15 19:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6052482f841634522c6d2e56c4231f8df2dc6d3e
commit r13-4075-g6052482f841634522c6d2e56c4231f8df2dc6d3e
Author: David Faust <david.faust@oracle.com>
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-15 19:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 19:04 [gcc r13-4075] bpf: avoid possible use of uninitialized variable David Faust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).