h3
                                
                                
                                
                                    h3 copied to clipboard
                            
                            
                            
                        vertex: usage of uninitialized field
Hey everyone 🙂👋
I was trying to build the lib from v3.7.1 sources and I faced this issue/warning, is it something expected ?
Don't hesitate to tell me if I can help on this 👍
$cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DBUILD_TESTING=0 -DBUILD_GENERATORS=0 -DBUILD_BENCHMARKS=0 -DBUILD_FILTERS=0 -DENABLE_LINTING=0 -DENABLE_DOCS=0 -DENABLE_COVERAGE=0
...skipped...
...skipped...
...skipped...
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c: In function 'vertexRotations':
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c:80:47: warning: 'dirFaces.faces[3]' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (cellLeadingDigit == JK_AXES_DIGIT &&
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
             fijk.face ==
             ~~~~~~~~~~~~
                 dirFaces.faces[IK_AXES_DIGIT - DIRECTION_INDEX_OFFSET]) {
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/h3-3.7.1/src/h3lib/lib/vertex.c:85:54: warning: 'dirFaces.faces[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
         } else if (cellLeadingDigit == IK_AXES_DIGIT &&
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                    fijk.face ==
                    ~~~~~~~~~~~~
                        dirFaces.faces[JK_AXES_DIGIT - DIRECTION_INDEX_OFFSET]) {
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    
                                    
                                    
                                
This is not a warning I've seen when building locally, so I imagine it's compiler-specific. Looking at the code, it's a reasonable warning - the compiler very likely cannot statically verify that dirFaces was assigned, though it should be guaranteed. We ought to be able to add a guard here that would remove the compiler warning.
I'm having same issue: ...../vertex.c(85,47): warning GF881FBBE: ‘dirFaces.faces[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized] [/__w/1/s/Src/Linux/Cmake.Build/Cmake.Build.csproj] ...../vertex.c(90,54): warning G214ECD21: ‘dirFaces.faces[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized] [/__w/1/s/Src/Linux/Cmake.Build/Cmake.Build.csproj]