aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/bpf
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2022-11-15 09:21:51 -0800
committerDavid Faust <david.faust@oracle.com>2022-11-15 11:01:36 -0800
commit6052482f841634522c6d2e56c4231f8df2dc6d3e (patch)
treeadce04272a5289a494e56fdac14d0587e330cca9 /gcc/config/bpf
parent86a90006864840c2e222d46ead551850caba184b (diff)
downloadgcc-6052482f841634522c6d2e56c4231f8df2dc6d3e.zip
gcc-6052482f841634522c6d2e56c4231f8df2dc6d3e.tar.gz
gcc-6052482f841634522c6d2e56c4231f8df2dc6d3e.tar.bz2
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.
Diffstat (limited to 'gcc/config/bpf')
-rw-r--r--gcc/config/bpf/bpf.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index 16af241..51e4695 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;