stb icon indicating copy to clipboard operation
stb copied to clipboard

Possible use of uninitialized value in stb_voxel_render.h?

Open musicinmybrain opened this issue 3 years ago • 0 comments

I’m looking at a compiler warning:

In file included from test_c_compilation.c:30:
../stb_voxel_render.h: In function 'stbvox_make_mesh_for_block_with_geo':
../stb_voxel_render.h:3033:37: warning: 'rot' may be used uninitialized in this function [-Wmaybe-uninitialized]
 3033 |       rot = mm->input.packed_compact[rot] & 3;
      |                                     ^

It seems that rot on the RHS could indeed be uninitialized if all of these are true:

  • mm->input has null/false geometry
  • mm->input has non-null/true packed_compact
  • the STBVOX_CONFIX_ROTATION_IN_LIGHTING macro is defined

musicinmybrain avatar Aug 19 '21 21:08 musicinmybrain