]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix GCC 13 warns: ‘new_velocity[0]’ may be used uninitialized
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 27 Oct 2023 15:47:55 +0000 (01:47 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 28 Oct 2023 08:23:11 +0000 (18:23 +1000)
Pretty sure this was a false positive, for it to happen `numplanes`
would have to be <= 0 in the loop which sets `new_velocity` which should
be impossible.  Declaring `numplanes` as unsigned placates the compiler,
and these ints should be unsigned anyway because they index an array.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
sv_phys.c

index 77c3bacfc71058bb7a66e957ded188571f8be71a..f468a7e9d2a26e4b395b81403b128d7d7855db72 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1199,8 +1199,7 @@ static qbool SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, qboo
 static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float *stepnormal, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float stepheight)
 {
        prvm_prog_t *prog = SVVM_prog;
-       int blocked, bumpcount;
-       int i, j, numplanes;
+       unsigned int i, j, numplanes, blocked, bumpcount;
        float d, time_left, gravity;
        vec3_t dir, push, planes[MAX_CLIP_PLANES];
        prvm_vec3_t primal_velocity, original_velocity, new_velocity, restore_velocity;