From 8af1023b7bb592825f4c5f534db2696c25a1e9aa Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Wed, 3 May 2023 21:52:51 -0400 Subject: [PATCH] In reality, tbuff[5] will be zeroed by the strcpy() two lines earlier. But gcc-7.5.0 doesn't appear to realize that; it complains that 'comment_observation' may read uninitialized space. Later gccs appear to have figured this one out, but we now explicitly set tbuff[5] just to suppress the warning (which, with -Werror, is an error). --- mpc_obs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpc_obs.cpp b/mpc_obs.cpp index 39dc9bec..e3d23a99 100644 --- a/mpc_obs.cpp +++ b/mpc_obs.cpp @@ -3681,12 +3681,13 @@ OBSERVE FAR *load_observations( FILE *ifile, const char *packed_desig, error_code = get_satellite_offset( second_line, vect); if( error_code) { - char tbuff[8]; + char tbuff[6]; rval[i].flags |= OBS_DONT_USE; rval[i].is_included = 0; strcpy( tbuff, "?off "); tbuff[4] = (char)( '0' - error_code); + tbuff[5] = '\0'; comment_observation( rval + i, tbuff); n_bad_satellite_offsets++; debug_printf( "Error code %d; offending line was:\n%s\n",