From 997b480cc4239a7f55771535dff52ad69bd4eb5b Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Mon, 30 Sep 2024 12:38:46 +0300 Subject: [PATCH] gcc: Fix gcc warnings when compiling on > -O2 Signed-off-by: Pantelis Antoniou --- src/allocator/fy-allocator-mremap.c | 3 ++- src/lib/fy-diag.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/allocator/fy-allocator-mremap.c b/src/allocator/fy-allocator-mremap.c index 72c1bba..32933fa 100644 --- a/src/allocator/fy-allocator-mremap.c +++ b/src/allocator/fy-allocator-mremap.c @@ -815,7 +815,8 @@ static int fy_mremap_get_tag(struct fy_allocator *a) goto err_out; mrt = fy_mremap_tag_from_tag(mra, id); - assert(mrt); + if (!mrt) + goto err_out; fy_mremap_tag_setup(mra, mrt); diff --git a/src/lib/fy-diag.c b/src/lib/fy-diag.c index a7c1a86..a99b2d6 100644 --- a/src/lib/fy-diag.c +++ b/src/lib/fy-diag.c @@ -600,6 +600,10 @@ void fy_diag_error_atom_display(struct fy_diag *diag, enum fy_error_type type, s fy_diag_get_error_colors(diag, type, &color_start, &color_end, &white); + /* pacify compilers that think these are uninitialized */ + cols = 0; + rowbufsz = 0; + /* two passes, first one collects extents */ start_col = -1;